Author |
Message
|
vennela |
Posted: Wed Mar 29, 2006 11:52 pm Post subject: MB as publisher and JMS app as subscriber |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
If I use regular MQ QMGR as my pub sub broker, I can have JMS program doing both publishing and subscribing.
For that all I do is create topics and do the publishing and subscribing.
Now with MB, I use a publication node and do the publishing. I use an MQ queue as the subscriber.
Can I subscribe using a JMS program without an MQ Queue? |
|
Back to top |
|
 |
fschofer |
Posted: Thu Mar 30, 2006 12:07 am Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
|
Back to top |
|
 |
vennela |
Posted: Thu Mar 30, 2006 12:20 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
That doesn't answer my question or maybe I didn't make myself clear.
I am publishing using MB.
In my flow where I publish, I have a simple flow
MQInput -> Compute (build RFH2 to pub)-> Publication
Now how can a JMS program subscribe to the topic?
One way I know is send broker a subscription message so that the messages come to an MQ Queue and then my JMS app can pick it up
Is this the only way? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 30, 2006 6:26 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Mar 30, 2006 2:22 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
vennela wrote: |
That doesn't answer my question or maybe I didn't make myself clear.
I am publishing using MB.
In my flow where I publish, I have a simple flow
MQInput -> Compute (build RFH2 to pub)-> Publication
Now how can a JMS program subscribe to the topic?
One way I know is send broker a subscription message so that the messages come to an MQ Queue and then my JMS app can pick it up
Is this the only way? |
You can use rfhutil to create a subscription message and put it to the SYSTEM.BROKER.CONTROL.QUEUE.
Remember to put a destination (reply to ) to the subscription message.
You can then have an MDB or any other app pick up the publications from that queue.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
PieterV |
Posted: Thu Mar 01, 2007 7:19 am Post subject: |
|
|
Disciple
Joined: 04 Jan 2006 Posts: 164 Location: Belgium
|
*KICK*
is it not possible to create a dynamic subscription using JMS to a Topic created in the broker? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 01, 2007 7:21 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Watch your feet there, man...
Sure. You just have to configure the TCFs and Topics to point to the broker queue manager. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
PieterV |
Posted: Thu Mar 01, 2007 7:47 am Post subject: |
|
|
Disciple
Joined: 04 Jan 2006 Posts: 164 Location: Belgium
|
So i have to create a MQTopicConnectionFactory(); ?
if so, i'm still good.
But i receive following exception:
Code: |
Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
at com.ibm.mq.jms.MQConnection.<init>(MQConnection.java:563)
at com.ibm.mq.jms.MQTopicConnection.<init>(MQTopicConnection.java:107)
at com.ibm.mq.jms.MQTopicConnectionFactory.createMQTopicConnection(MQTopicConnectionFactory.java:378)
at com.ibm.mq.jms.MQTopicConnectionFactory.createTopicConnection(MQTopicConnectionFactory.java:270)
at JMS_SUB.createTopicConnectionFactory(JMS_SUB.java:226)
at JMS_SUB.<init>(JMS_SUB.java:71)
at JMS_SUB.main(JMS_SUB.java:323)
|
my code looks like this:
Code: |
Tfactory = new com.ibm.mq.jms.MQTopicConnectionFactory();
((MQTopicConnectionFactory)Tfactory).setPort(1418);
((MQTopicConnectionFactory)Tfactory).setHostName("machine");
((MQTopicConnectionFactory)Tfactory).setClientID("userid");
((MQTopicConnectionFactory)Tfactory).setChannel("channel");
((MQTopicConnectionFactory)Tfactory).setTransportType(com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
((MQTopicConnectionFactory)Tfactory).setQueueManager("qmgr") ;
Tconnection = Tfactory.createTopicConnection("userid", "");
|
of course all in a try catch
i receive the error on line:
Code: |
Tconnection = Tfactory.createTopicConnection("userid", "");
|
my imports (i know, i have doubles):
Code: |
import javax.swing.*;
import java.awt.*;
import com.ibm.*;
import com.ibm.mq.jms.*;
import javax.jms.*;
import javax.transaction.*;
import java.awt.event.*;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import javax.naming.InitialContext;
import javax.naming.NamingException;
|
|
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 01, 2007 7:50 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
PieterV |
Posted: Fri Mar 02, 2007 7:14 am Post subject: |
|
|
Disciple
Joined: 04 Jan 2006 Posts: 164 Location: Belgium
|
Thank you Jeff,
now i've managed to create a subscription.
The problem relied to a wrong version of jar files or something like that.
Anyway, now i have another question.
why is the subscription always on SYSTEM.JMS.D.SUBSCRIBER.QUEUE
in other words, how can i specify a queue for a subscriber.
(the idea behind it is to attach a flow to a certain queue for each subscriber). |
|
Back to top |
|
 |
PieterV |
Posted: Mon Mar 05, 2007 2:10 am Post subject: |
|
|
Disciple
Joined: 04 Jan 2006 Posts: 164 Location: Belgium
|
Ok, again a step futher.
I can specify a queue name by setting the attribute to something like
MQTtopic.setBrokerDurSubQueue("SYSTEM.JMS.D.PIETER.*");
But i've noticed an annoying thing.
I create a topic in the broker toolkit, and then use a JMS program to subscribe to it.
All goes well, but somehow all my message flows that are running on that broker trying to do something with those subscription:
Mar 5 11:08:33 uxhades2da WebSphere Broker v6003[241]: [ID 702911 user.error] (WBIMBBRT.a926-test)[29]BIP2230E: Error detected whilst processing a message in node 'DynamicSubscriptionEngine'. : WBIMBBRT.255c577f-0e01-0000-0080-9bf727b1a233: /build/S600_P/src/DataFlowEngine/JavaNodeLibrary/ImbPubSubResource.cpp: 1450: ImbPubSubResource::handleResourceInternal: DynamicSubscriptionEngine: DynamicSubscriptionEngine
Mar 5 11:03:28 uxhades2da WebSphere Broker v6003[299]: [ID 702911 user.error] (WBIMBBRT.a130-staangeld)[30]BIP2648E: Message backed out to a queue; node 'PubSubControlMsgFlow.InputNode'. : WBIMBBRT.ea295403-1101-0000-0080-b00df656bcf0: /build/S600_P/src/DataFlowEngine/ImbMqInputNode.cpp: 1859: ImbCommonInputNode::eligibleForBackout: ComIbmMQInputNode: InputNode
anyone any idea? |
|
Back to top |
|
 |
|