2 Replies Latest reply on May 3, 2013 2:48 AM by m.myslik

    Sending a message through Scheduler

    m.myslik

      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?