So here's my problem!
I Have a Tibco EMS topic with authentication
I have a standalone app I'd like to pub and consume messages from this
And I'd like to do this through Springs JMSTemplate, Listener etc.
E.x listener:
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");
}
}
}
Sample publisher:
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's 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 this possible?
Than开发者_StackOverflow中文版ks
Yes. This is a fairly typical setup.
You will just require some extra configuration to compensate for the fact that you are not operating inside a Java EE environment. Thus you don't have simple JNDI lookups via resource refs.
精彩评论