hi all,
I want to create a java class as a subscriber to a nirvana’s queue .
I’ve been trying to make it and I am on it.
But I am afraid that Nirvana’s team already created and I missed it.
Is there any suggestion or information about this?
Thank you for your help.
I doubt if nirvana team gives an out of box java subscriber. But As you are already on it, it is quite easy to write one on your own. You can use javax.jms.* API and it should be few lines of code.
Hi Prasad,
I tried to execute this code :
Properties initialContextProperties = new Properties();
initialContextProperties.put("java.naming.factory.initial",
"com.pcbsys.nirvana.nSpace.NirvanaContextFactory");
String connectionString = "nsp://myIp:9000/";
initialContextProperties.put("connectionfactory.qpidConnectionfactory", connectionString);
try {
InitialContext initialContext = new InitialContext(initialContextProperties);
QueueConnectionFactory queueConnectionFactory
= (QueueConnectionFactory) initialContext.lookup("UMConnFactorySD");
QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
queueConnection.start();
QueueSession queueSession = queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
// Send message
Queue queue = queueSession.createQueue("testQueue;{create:always, node:{durable: true}}");
QueueSender queueSender = queueSession.createSender(queue);
for(int count =0; count<2; count++)
{
queueSender.send(queueSession.createObjectMessage(new Integer(count)));
}
// Housekeeping
queueSender.close();
queueSession.close();
queueConnection.stop();
queueConnection.close();
But still catched by jmsexception like below
I tried that url and send message via ESB document, it’s running well.
am I missing something for creating that contextfactory ?
Thank you
You have to include the nirvana client libraries (nJMS.jar and nClient.jar) as part of your java project where you are writing your subscriber.
You can find these jars under “/common/lib” directory.
All nirvana related libraries start with “n” like below:
“C:\SoftwareAG\common\lib\nJMS.jar”
“C:\SoftwareAG\common\lib\nClient.jar”
As per my experience, just nJMS and nClient jars should be enough to run your subscriber. But in case your program is still complaining after placing these two jars try adding other nirvana libraries too and see the behavior.
1 Like
Hi Prasad,
I found that there are some java code in universalmessaging/java/examples/com/pcbsys/nirvana/apps
and I use Qpublish.java for my case.
Thank you for your help Prasad.
cheers,
You have to include the nirvana client libraries (nJMS.jar and nClient.jar) as part of your java project where you are writing your subscriber.
You can find these jars under “/common/lib” directory.
All nirvana related libraries start with “n” like below:
“C:\SoftwareAG\common\lib\nJMS.jar”
“C:\SoftwareAG\common\lib\nClient.jar”
As per my experience, just nJMS and nClient jars should be enough to run your subscriber. But in case your program is still complaining after placing these two jars try adding other nirvana libraries too and see the behavior.
Hi All,
Sorry for hi-jacking this thread.
I was not able to create new one.
I’m not able to subscribe to queue. I didn’t find enough documentation online.
I have attached the configuration file, Java MDB code & error log file.
I’m trying to resolve this past 4 weeks. Your help will be much appreciated.
Thanks,
Madhvi Desai
Error_Logs.txt (4.47 KB)
FetchMessages.java (1.97 KB)
standalone.xml (19.5 KB)