Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7506491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:17:55+00:00 2026-05-29T22:17:55+00:00

I have a running Mule application I am using in my project. What I

  • 0

I have a running Mule application I am using in my project. What I would like to do is add some component that would clear some database table everytime the Mule server is started up.

What would be the component to use in this matter? Preferably I’d like it to happen from XML and not some Java component I have to write (JDBC and such)

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:17:55+00:00Added an answer on May 29, 2026 at 10:17 pm

    Done with:

    • A notification listener to be informed when Mule is initialized,
    • Implemented in Groovy so all code is in the XML config,
    • A JDBC endpoint to purge the data so no JDBC is needed.

    Here is the config:

    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc"
        xmlns:spring="http://www.springframework.org/schema/beans"
        xmlns:lang="http://www.springframework.org/schema/lang"
        xsi:schemaLocation="
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd
                http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
                http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/3.2/mule-jdbc.xsd
                ">
        <spring:beans>
            <spring:bean id="jdbcDataSource" class="org.hsqldb.jdbc.JDBCDataSource">
                <spring:property name="url" value="jdbc:hsqldb:mem:test-db" />
            </spring:bean>
    
            <lang:groovy id="dataInitializer">
                <lang:inline-script><![CDATA[
                    import org.mule.api.context.notification.*;
                    import org.mule.context.notification.*;
                    import org.mule.module.client.MuleClient;
    
                    class DataInitializer implements MuleContextNotificationListener<MuleContextNotification> {
    
                        public void onNotification(MuleContextNotification notification) {
                            if (notification.action == MuleContextNotification.CONTEXT_STARTED)
                                new MuleClient(notification.muleContext).dispatch("jdbc://initialDataPurge", null, null)
                        }
                    }
                ]]></lang:inline-script>
            </lang:groovy>
        </spring:beans>
    
        <notifications>
            <notification event="CONTEXT"/>
            <notification-listener ref="dataInitializer"/>
        </notifications>
    
        <jdbc:connector name="jdbcConnector" dataSource-ref="jdbcDataSource">
            <jdbc:query key="initialDataPurge" value="DELETE FROM test;" />
        </jdbc:connector>
    </mule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have have running windows service that is using it's app.config for getting some
I have a table setup in my database with this structure: I have running
My application needs to calls a number of web services that I have running
Problem: I have a python script that I have running as a service. It's
I have been running Visual Studio 2008 Team Edition for some time now and
I have MySQL running such that I can open a client command line and
I want to export the datastore that I have running in App Engine into
I have an Android application that is a TabHost with a WebView. I use
I have running a project in hibernate and the connection and pojo classes are
This question was asked at interview.I need to have running total ( only using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.