Author |
Message
|
ayanc |
Posted: Thu Jun 22, 2006 4:33 am Post subject: Native Java + PubSub Problems |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi All,
I have started trying out using Java for basic MQ operations like put message and get message. While trying to use subscriber registration and deregistration I am facing strange problems.
I have created a message with MQRFH2 header and sent it to the SYSTEM.BROKER.CONTROL.QUEUE
The message type is request and the reply to queue has been set.
Below are the cases which have been tried sequentially.
Case 1:
Topic: sports/cricket
Queue: JAVA.SUB
Command: RegSub
Result: Successfully subscribed. Reply message with Completion OK.
Case 2:
Topic: sports/cricket
Queue: Some invalid queue
Command: RegSub
Result: Received reply message with Completion as Error and the reason code specified.
Case 3:
Topic: sports/football
Queue: JAVA.SUB
Command: RegSub
Result: No subscription takes place. Msg in DLQ. No reply received.
Case 4:
Topic: sports/cricket
Queue: JAVA.SUB
Command: DeregSub
Result: No subscription takes place. Msg in DLQ. No reply received.
Can anyone tell me as to what is going wrong? I tried the same action using RFHUTIL and the results are the same!!!
Plz Note: I have not used PSCR folder of MQRFH2.
Environment: Win XP SP2
WMQ 5.3 CSD 10
WBIMB 5.0 CSD 05
Thanks. |
|
Back to top |
|
 |
vennela |
Posted: Thu Jun 22, 2006 7:58 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Try the sample jmspubsub supplied along with the product |
|
Back to top |
|
 |
ayanc |
Posted: Thu Jun 22, 2006 9:39 pm Post subject: |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi Vennela,
Thanks for your response.
I am aware that JMS provides better possibilities for pub-sub related programming with MQSeries. However the trouble is I know very little of JAVA and nothing about JMS. So, it may take me some more time to learn JMS.
Anyway I have figured out the problem and have solved it. I believe the broker parses the data in multiple of 4 bytes. So I padded spaces to the data rounding off to the higher 4 byte value. This strategy worked out.
So, now my subscription registration and de-registration are working just fine.
However if I provide an invalid topic say: /xyz/abc, I expected to find an error response sent. Instead the message goes to DLQ and no response is sent.
Given the current scenario I find it very strange the behaviour of the broker. Even a program like RFHUtil giving me the same results has added to the confusion.
I am sure that I am going wrong somewhere although I am not able to point it out.
Is there a set of scenarios in which we dont get any error response? How can we get all the response messages from the broker ... error / warning / ok ?
Can anybody help me to understand where I am going wrong?
Thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jun 23, 2006 2:11 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The MQRFH2 does need to be padded to 4 byte boundaries, yes.
Using JMS means you don't have to know that.
There is no such thing as an "invalid topic" however - unless you're running the User Name Server. Well, I guess there could be a topic name with invalid characters... and that should maybe give you an error response?
Otherwise you can register a subscription for any topic you want, and publish messages on any topic you want. I suppose if you publish a message on a topic that has no subscribers and the message is persistent, then you might see the message go to the DLQ. But you should never expect a response that tells you that nobody is subscribed to the topic you just published on. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ayanc |
Posted: Fri Jun 23, 2006 2:37 am Post subject: |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi Jeff,
I am not using any User Name Server. But it seems that topics that begin with "/" are not accepted by the broker. It is evident that the "/" character has a special meaning to the broker as it divides the topic into groups and sub-groups.
However if there is an error with the topic then a response message must be sent.
For eg: Consider the topic xyz/#/abc/# . This topic is invalid because the broker doesnt support more than one "#". So, I am getting a valid response message with Completion as Error and Reason Code 3072, which is actually MQRCCF_TOPIC_ERROR.
But I wonder why I am not getting any message if my topic begins with "/". Maybe the ppl from IBM can shed some light onto this.
Quote: |
I suppose if you publish a message on a topic that has no subscribers and the message is persistent, then you might see the message go to the DLQ. But you should never expect a response that tells you that nobody is subscribed to the topic you just published on.
|
I totally agree with u.
Thanks |
|
Back to top |
|
 |
mvic |
Posted: Fri Jun 23, 2006 3:14 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
|
Back to top |
|
 |
ayanc |
Posted: Fri Jun 23, 2006 4:22 am Post subject: |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi All,
I am sorry for creating this confusion. I actually called the topic "/xyz/abc" as invalid because I failed to get it subscribed. Frankly speaking I do not know whether this topic is invalid.
But my point is :
If this topic is valid ... then why am I not able to subscribe to it.
If this topic is invalid ... then why am I not getting an error response.
I have tried this using my Java program as well as RFHUtil. Both of them have the same results. The message simply goes to the DLQ.
The only thing that I noticed is that the topic contains "/" character, which is a group level separator, in the beginning. So, I just guessed that, may be the broker is expecting something before the "/" character.
I again agree with you ... there is no reference to this. However all the topics provided in the sample do not start with a leading "/" character.
Can any one tell me where I am missing out on this?
Thanks |
|
Back to top |
|
 |
mvic |
Posted: Fri Jun 23, 2006 5:41 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
ayanc wrote: |
Can any one tell me where I am missing out on this? |
I would say that, if you can show that an app that is subscribed to a topic does not receive a message published on that topic, then this is a reason to call IBM Support and report the issue. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jun 23, 2006 1:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
The TOPIC IS NOT A DIRECTORY AND THERE IS NO RELATIVE POSITIONNING! NOT WHEN PUBLISHING, NOT WHEN SUBSCRIBING!
As such you always start at the root for your topic tree. Note that the '/' is a topic SEPARATOR. If you start with '/' there is no topic to separate from and as such starting your topic tree with '/' is illegal.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mvic |
Posted: Fri Jun 23, 2006 3:06 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jun 23, 2006 7:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Sure but the manuals talk a lot about relative positionning in the tree.
Quote: |
A leading "/" creates a distinct topic.
For example, "/USA" is different from "USA" and "/USA' matches "+/+" and "/+", but not "+". |
I have seen no exemple where a "root" topic is being referred to with a leading "/". Has anyone in the field created a root topic that is preceded by a '/' and what success / problems did he/she have with it?
When the manuals refer to topic /USA most of the time they mean a shortcut for something like SYSTEM.STREAM/USA... so I'd really like to hear from somebody who did use a topic like "/myroot".
Ref
Quote: |
For example, consider the following two topics:
1. level0/level1/+/level4/#
2. level0/level1/#+/level4/level#
|
Note the useage of level0 and not /level0....
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/topic/com.ibm.etools.mft.doc/aq13290_.htm#aq13290_.ide_05
See part "when wildcards are not wild"
Thanks _________________ MQ & Broker admin |
|
Back to top |
|
 |
ayanc |
Posted: Fri Jun 23, 2006 11:22 pm Post subject: |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi fjb,
As per the manual:
Quote: |
A leading "/" creates a distinct topic.
For example, "/USA" is different from "USA" and "/USA' matches "+/+" and "/+", but not "+".
|
The above statement seems to say that a leading "/" character in a topic is valid but has a different meaning.
fjb_saper wrote:
Quote: |
As such you always start at the root for your topic tree. Note that the '/' is a topic SEPARATOR. If you start with '/' there is no topic to separate from and as such starting your topic tree with '/' is illegal.
|
Let me agree that a topic beginning with "/" is illegal as you have stated. But then why dont I get a response message stating that it is so?
I expected to see an error message with Reason Code 3072 which is MQRCCF_TOPIC_ERROR.
Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Jun 24, 2006 8:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Please note that the behavior of the Pub/sub Engine in WMB and the behavior of the pub/sub engine in the base product (the "Fuji" broker) is completely different.
Please identify which broker you are using. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ayanc |
Posted: Sat Jun 24, 2006 9:28 pm Post subject: |
|
|
Voyager
Joined: 15 Nov 2004 Posts: 88
|
Hi Jeff,
I believe that I am using the normal WMB broker. However I am not sure what the "Fuji" broker means. As far as I know I have only one broker installed in my machine( the one I start using Windows Services).
Please feel free to ask for any info you want.
Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Jun 25, 2006 2:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The "Fuji" broker is what used to be a Support Pack and is now included with the product - it's the "base MQ" pub/sub broker.
If you're using Message Broker, you aren't using the base MQ broker. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|