JBoss Community

JBossESB - sending an ESB aware message

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

Hi, I am a newbie to JBossESB and I am currently writing a test client to send both ESB aware and ESB unaware(JMS) messages to que. JMS messages work just fine, but I have a problem with ESB aware clients. I think that there is probably something wrong with my jboss-esb.xml file. (I am running my JBoss AS on a localhost and I am trying to connect to it from and outside application).

 

This is my sample code for ESB message sender:

 

public class SenderESB {

   

    private String name = "NoName";

   

    public SenderESB(String name) {

        this.name = name;

    }

   

    //send ESB message

    public void sendAMessage(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("ESB-Listener","Serviceconsumer");

          

    

          // 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);

    }

   

    //GETTERS

    public String getName() {

        return name;

    }

 

}

 

I am putting here my jboss-esb.xml as an attachment... Thanks for any answer.

Reply to this message by going to Community

Start a new discussion in JBoss ESB Development at Community