Is it possible to implement JMS, Spring and Tibco EMS in a standalone Java application?

So here is my problem!

I have a Tibco EMS theme with authentication

I have a standalone application that I would like to publish and use in this post

And I would like to do this through Springs JMSTemplate, Listener, etc.

Listener Ex:

public class ExampleListener implements MessageListener {

public void onMessage(Message message) {
    if (message instanceof TextMessage) {
        try {
            //TODO DAO interface to write to db
            System.out.println(((TextMessage) message).getText());
        } catch (JMSException e) {
            throw new RuntimeException(e);
        }
    } else {
        throw new IllegalArgumentException(
                "Message must be of type TestMessage");
    }
} 

}

Publisher example:

import org.springframework.jms.core.JmsTemplate;

public class ExampleProducer {

private JMSTemplate jmsTemplate;

public ExampleProducer(JmsTemplate jmsTemplate) {
    this.jmsTemplate = jmsTemplate;
}

public void sendMessage() {
    jmsTemplate.convertAndSend("Example Message");
}

}

and here some of the properties:

jms.jndi.initialContextFactory = com.tibco.tibjms.naming.TibjmsInitialContextFactory jms.jndi.urlPkgs = com.tibco.tibjms.naming

jms.jndi.providerUrl = tibjmsnaming: / **** .net: ***

Is it possible?

thank

+3
source share
1 answer

Yes. This is a pretty typical setup.

, , Java EE. , JNDI .

+1

All Articles