Author |
Message
|
ravip |
Posted: Tue Feb 22, 2005 7:14 pm Post subject: Message driven bean publish/subscribe problem |
|
|
Novice
Joined: 22 Feb 2005 Posts: 23
|
Have an MDB which is listening to the messages published on a topic. Both the TopicConnectionFactory and the Topic are registered in the JNDI tree. We were getting the messages ok but the MDB stopped sucking the messages suddenly. Not sure what happened, we have'nt changed any configuration on MQ. The broker is running and the listener is running as well, I could ping from the box where the MDB is deployed and could do that with success. Not sure where the problem could be, checked all the configuration parameters that we could. The weird thing is in the MQTopicConnectionFactory when I changed the ipaddress to point to an other box where the pub/sub package was installed it could retrieve the messages successfully, so its getting harder for us to debug this problem. We're making a client connection to the MQ box. Did anyone face a similar situation before? Any suggestions please? |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Feb 22, 2005 8:37 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
On top of the topic listener do you also have an error listener ?
On a client connection I consider it a must.
 |
|
Back to top |
|
 |
ravip |
Posted: Wed Feb 23, 2005 8:55 am Post subject: |
|
|
Novice
Joined: 22 Feb 2005 Posts: 23
|
this is what I found out, we wanted to have a separate queue for each durable subscription for a topic and we changed this when we are binding the same to JNDI
Topic t = (Topic)session.createTopic("topic://mytopic");
((MQTopic)t).setBrokerDurSubQueue("SYSTEM.JMS.D.SAMPLE.*");
ctx.rebind("com.mycompany.module.MQExampleTopic", t);
the new line that was added was ((MQTopic)t).setBrokerDurSubQueue("SYSTEM.JMS.D.SAMPLE.*");
and after putting this and binding the objects to JNDI my MDB is not working anymore, is there something that I'm missing? do I have to change something in my MDB? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 23, 2005 12:47 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
This is a crazy scenario.
You should be using a defined queue for the durable subscription and not some kind of dynamic queue. (whether tempdyn or permdyn)
Anyways I don't believe that the "*" char is allowed in a queue name.
You are not using it to create the queue from a model queue, (JMS has some specifics like session.createTempQueue(string) or something like it) so ....
The question is really what's going on and what are you attempting to do?
Review the whole architecture.
 |
|
Back to top |
|
 |
ravip |
Posted: Wed Feb 23, 2005 12:58 pm Post subject: |
|
|
Novice
Joined: 22 Feb 2005 Posts: 23
|
I was using this API setBrokerDurSubQueue name to change the queue name that the broker writes the messages for this topic. I'm was using the * at the end of the queue name since the using Java manual states that I can't use a specific queue name for durable subscribers. All I wanted was to have the messages put on a separate queue for the durable subscribers to this topic instead of the default queue SYSTEM.JMS.D.SUBSCRIBER.QUEUE. Is there something that I'm doing wrong? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 23, 2005 1:11 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Question 1: is the broker on the same qmgr as the subscriber
Question 2: do the broker and qmgr have a default way to communicate
Question 3: did you specify in your jndi setup of TopicConnectionFactory where the broker resides?
For a non durable subscription you should always supply a model queue to the factory so that you can create temporary queues.
However I would want to check out a little bit better the concepts and the API. Get the latest using java manual (see documentation link) and make sure you will be able to handle multiple durable subscriptions as dynamic queue creation.... Remember you will still need to register the subscription... See API.
In your case and using the MDB setup I would want a fixed queue defined in JNDI. Makes much more sense. And if possible keep it all portable: no use of MQTopic just use Topic from javax.jms.Topic.
Enjoy  |
|
Back to top |
|
 |
ravip |
Posted: Wed Feb 23, 2005 1:58 pm Post subject: |
|
|
Novice
Joined: 22 Feb 2005 Posts: 23
|
thanks for the pointers, just to make this clear, given below is the code that I use to bind the TopicConnectionFactory and the Topics to JNDI
import java.io.*;
import java.util.*;
import javax.jms.*;
import com.ibm.jms.*;
import com.ibm.mqbind.*;
import com.ibm.mq.jms.*;
import com.ibm.mq.jms.JMSC;
import javax.naming.InitialContext;
import javax.naming.Context;
public class MQJNDIBind {
final Hashtable properties = new Hashtable();
public MQJNDIBind (){}
/**
* function to init and send the message
* @throws Exception in case of an error
*/
public void bindJNDI() throws Exception {
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, "t3://ravip:7001");
properties.put("weblogic.jndi.createIntermediateContexts", "true");
InitialContext ctx = new InitialContext(properties);
MQTopicConnectionFactory topicFactory = new MQTopicConnectionFactory();
topicFactory.setQueueManager("EXAMPLEQMGR");
topicFactory.setBrokerQueueManager("EXAMPLEQMGR");
topicFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
topicFactory.setHostName("141.149.21.105");
topicFactory.setPort(1414);
topicFactory.setChannel("IOMSVRCHAN");
//topicFactory.setUseConnectionPooling(true);
TopicConnectionFactory tFactory = (TopicConnectionFactory)topicFactory;
TopicConnection connection = tFactory.createTopicConnection();
TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
Topic t = (Topic)session.createTopic("topic://exampletopic");
((MQTopic)t).setBrokerDurSubQueue("SYSTEM.JMS.D.MQSAMPLE.*");
TopicSubscriber tsub = session.createSubscriber(t);
connection.start();
ctx.rebind("com.verizon.ea.MQNotificationTopicFactory", tFactory);
ctx.rebind("com.verizon.ea.MQExampleTopic", t);
}
public static void main(String args[]) throws Exception {
try {
new MQJNDIBind().bindJNDI();
}catch(Exception e) {
e.printStackTrace();
}
}
}
I give the topic name com.verion.ea.ExampleTopic as the topic (bound in weblogic jndi) for the Message driven bean, everything seems to be working ok when I remove the setBrokerSubQName API from this code, not sure whats going wrong |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 23, 2005 2:52 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
On the pub/sub for multiple durable subscribers with dynamic queues it says that after having registered the queue (as you did) you still need to subscribe to the topic.
That's why it is more pertinent to set up a static queue in JNDI and make the durable subscription thereon, unless you would like to run a BB out of your website. In that case creating a durable subscription on a dynamic queue makes sense. Otherwise I'd have a hard time finding a scenario that would justify it....
Enjoy  |
|
Back to top |
|
 |
ravip |
Posted: Wed Feb 23, 2005 3:14 pm Post subject: |
|
|
Novice
Joined: 22 Feb 2005 Posts: 23
|
On the pub/sub for multiple durable subscribers with dynamic queues it says that after having registered the queue (as you did) you still need to subscribe to the topic.
could'nt get this, can you please explain in detail. Also forgot to mention that my broker is residing on a remote mqseries box and the MDB is deployed on weblogic in my local machine |
|
Back to top |
|
 |
ravip |
Posted: Thu Feb 24, 2005 9:37 am Post subject: |
|
|
Novice
Joined: 22 Feb 2005 Posts: 23
|
did setup an exception listener for the MDB but don't notice any errors at all, its still not able to get the connection to the mqjms, don't see any errors in the logs too |
|
Back to top |
|
 |
ravip |
Posted: Thu Feb 24, 2005 9:41 am Post subject: |
|
|
Novice
Joined: 22 Feb 2005 Posts: 23
|
Sorry this is the exception that I noticed in the weblogic logs regarding the failure to connect to the JMS destination
com.ibm.mq.jms.BrokerCommandFailedException: Broker command failed: MQRCCF_SUBSCRIPTION_LOCKED Reason code 3156
com.ibm.mq.jms.BrokerCommandFailedException: Broker command failed: MQRCCF_SUBSCRIPTION_LOCKED Reason code 3156
at com.ibm.mq.jms.MQBrokerSubscriptionEngine.openDurableSubscription(MQBrokerSubscriptionEngine.java:1007)
at com.ibm.mq.jms.MQMigrateSubscriptionEngine.openDurableSubscription(MQMigrateSubscriptionEngine.java:542)
at com.ibm.mq.jms.MQTopicSession.createDurableSubscriber(MQTopicSession.java:755)
at com.ibm.mq.jms.MQTopicSession.createDurableSubscriber(MQTopicSession.java:594)
at weblogic.ejb20.internal.JMSConnectionPoller.setUpTopicSessions(JMSConnectionPoller.java:1511)
at weblogic.ejb20.internal.JMSConnectionPoller.createJMSConnection(JMSConnectionPoller.java:1984)
at weblogic.ejb20.internal.JMSConnectionPoller.connectToJMS(JMSConnectionPoller.java:1144)
at weblogic.ejb20.internal.JMSConnectionPoller.trigger(JMSConnectionPoller.java:942)
at weblogic.time.common.internal.ScheduledTrigger.run(ScheduledTrigger.java:181)
at weblogic.security.service.SecurityServiceManager.contact admin(SecurityServiceManager.java:685)
at weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigger.java:167)
at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java:161)
at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:39)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:251)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:219) |
|
Back to top |
|
 |
ravip |
Posted: Fri Feb 25, 2005 10:06 am Post subject: |
|
|
Novice
Joined: 22 Feb 2005 Posts: 23
|
went through some documentation and here is what I found out
when you register a subscrition, you can set a bunch of registration options such as "AddName", "VariableUserId" JoinShared etc.
Where do we set all these options when using JMS? will this solve the problem of SUBSCRIPTION_LOCKED? |
|
Back to top |
|
 |
kattavee |
Posted: Thu Mar 19, 2009 1:40 pm Post subject: Publish/Subscribe problem |
|
|
Newbie
Joined: 17 Mar 2009 Posts: 1
|
Just wondering if there was any solution found for the issue ravip reported. We are also having the similar issue but with plain jms java program. We are not able to use the custom durable subcriber queue. Even though we created a local queue called SYSTEM.JMS.D.SB_TEST.SUBQ and set it as a durable subscriber using
topicConnfactory.setBrokerSubQueue("SYSTEM.JMS.D.SB_TEST.SUBQ")
it is always directing the messages to SYSTEM.JMS.D.SUBSCRIBER.QUEUE. We want to be able to subscribe durable messages using a custom durable subscriber queue. On a side note it is working fine with the Non-durable subscriptions. A similar issue was also reported by garypklos in another thread.
Any thoughts will be much appreciated. |
|
Back to top |
|
 |
|