JBoss Community

Sending a message through Scheduler

created by Martin MyslĂ­k in JBoss ESB Development - View the full discussion

Hi,

 

I am quite new to ESB and I would like to send messages from a service through simple scheduler. I have a class that has method which sends and ESB aware message:

 

public void sendMessage(String message) throws Exception

   {

      // Create the delivery adapter for the target service (cache it)

      System.setProperty("javax.xml.registry.ConnectionFactoryClass",

            "org.apache.ws.scout.registry.ConnectionFactoryImpl");

 

      // Create the delivery adapter for the target service (cache it)

      ServiceInvoker deliveryAdapter = new ServiceInvoker("FirstServiceESB",

            "SimpleListener");

      

 

      // Create and populate the request message...

      Message requestMessage = MessageFactory.getInstance().getMessage(

            MessageType.JBOSS_XML);

 

      requestMessage.getBody().add(message);

 

      // Deliver the request message synchronously - timeout after 20

      // seconds...

      deliveryAdapter.deliverAsync(requestMessage);

   }

 

I found only very vague tutorials on how to implement Scheduler (I mean in jboss-esb.xml file). How do I trigger this method? Can you show me and example jboss-esb.xml configuration taht would call sendMessage() function multiple times?

Reply to this message by going to Community

Start a new discussion in JBoss ESB Development at Community