ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Sample MQPubSubApiSample throws RC 2085

Post new topic  Reply to topic Goto page 1, 2  Next
 Sample MQPubSubApiSample throws RC 2085 « View previous topic :: View next topic » 
Author Message
RogerLacroix
PostPosted: Fri May 13, 2016 2:05 pm    Post subject: Sample MQPubSubApiSample throws RC 2085 Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

All,

I decided to play around with Topics and Subscriptions this afternoon.

I found MQPubSubApiSample.java in the MQ samples directory but the subscriber throws RC of 2085 (unknown object).

I checked the MQ Knowledge Center for MQPubSubApiSample and there is nothing about configuring topics/subscriptions. It just says to update the connection information (if necessary) then run it. (Note: I'm on Win 7 with MQ v8.0.0.4)

So what am I doing wrong?

Does anyone have any working Pub/Sub Java applications that they want to share?

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
hughson
PostPosted: Fri May 13, 2016 3:21 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Feels rather odd to be answering a Java question as I'm not known for my Java skills!

I can't run this sample because I haven't got working Java on the machine I'm on right now, but I looked in the java file at the code and saw this:-

Code:
/**
 * Demonstrates using the publish/subscribe API introduced into WebSphere MQ v7 Use system
 * properties to define the parameters :-
 * <ul>
 * <li>com.ibm.mq.pubSubSample.queueManagerName
 * <li>com.ibm.mq.pubSubSample.topicObject (default is "myTopicObject")
 * <li>com.ibm.mq.pubSubSample.subscriberCount (default is 3)
 * <ul>
 */


So do you have a topic object called "myTopicObject"?

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
RogerLacroix
PostPosted: Fri May 13, 2016 7:25 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

Hi Morag,

Yeah, setting those JVM environment variables allows the user to specify different values. I tried a different topic (i.e. roger) but it still failed with RC of 2085.

I've never played around with topics before, I guess I need to find a "How To" book somewhere because the simple stuff has stumped me.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
hughson
PostPosted: Fri May 13, 2016 8:27 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Did you try it with the myTopicObject? Did that work?

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
tczielke
PostPosted: Sat May 14, 2016 4:20 am    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 939
Location: Illinois, USA

It looks like the MQPubSubApiSample program uses code that requires the topic to be defined in the queue manager:

Code:

        MQDestination destinationForGet = queueManager.accessTopic(topicString, topicObject,
            CMQC.MQTOPIC_OPEN_AS_SUBSCRIPTION, openOptionsForGet);


The topicString is null and the topicObject is set here:

Code:

    topicObject = System.getProperty("com.ibm.mq.pubSubSample.topicObject", "myTopicObject");

_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
hughson
PostPosted: Sat May 14, 2016 4:27 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Agreed it needs a topic OBJECT defined with the name 'myTopicObject' (by default) and remember the case - i.e. use quotes when you define it.

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Sun May 15, 2016 6:29 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

tczielke wrote:
It looks like the MQPubSubApiSample program uses code that requires the topic to be defined in the queue manager:

Code:

        MQDestination destinationForGet = queueManager.accessTopic(topicString, topicObject,
            CMQC.MQTOPIC_OPEN_AS_SUBSCRIPTION, openOptionsForGet);


The topicString is null and the topicObject is set here:

Code:

    topicObject = System.getProperty("com.ibm.mq.pubSubSample.topicObject", "myTopicObject");

I did not verify it, but would it be possible to pass a topicString and null as topicObject?
Obviously if you do pass a topic object it has to be defined first (just like a queue)...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
hughson
PostPosted: Sun May 15, 2016 12:09 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

fjb_saper wrote:
I did not verify it, but would it be possible to pass a topicString and null as topicObject?
Obviously if you do pass a topic object it has to be defined first (just like a queue)...

The API allows this yes. You'd have to make changes to this sample to allow it though.

We haven't heard from Roger for a while. Are you all fixed now Roger?

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
tczielke
PostPosted: Sun May 15, 2016 4:03 pm    Post subject: Re: Sample MQPubSubApiSample throws RC 2085 Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 939
Location: Illinois, USA

RogerLacroix wrote:

Does anyone have any working Pub/Sub Java applications that they want to share?


I have been working through a JMS book (Java Message Service), and it has a chapter 2 example in the vendor agnostic source code at this link:

http://examples.oreilly.com/9780596000684/

called Chat.java. It uses pub/sub to create a simple chat program between users. Of course, the nice thing about JMS is you can compile the Chat.java program, and then run the same class file against IBM MQ or ActiveMQ with just some jndi.properties changes and the required administrative work (you do need to define a topic on the qmgr or ActiveMQ server thingy). Pretty slick on how portable Java/JMS makes this between JMS service providers.
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon May 16, 2016 12:24 am    Post subject: Re: Sample MQPubSubApiSample throws RC 2085 Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

tczielke wrote:
RogerLacroix wrote:

Does anyone have any working Pub/Sub Java applications that they want to share?


I have been working through a JMS book (Java Message Service), and it has a chapter 2 example in the vendor agnostic source code at this link:

http://examples.oreilly.com/9780596000684/

called Chat.java. It uses pub/sub to create a simple chat program between users. Of course, the nice thing about JMS is you can compile the Chat.java program, and then run the same class file against IBM MQ or ActiveMQ with just some jndi.properties changes and the required administrative work (you do need to define a topic on the qmgr or ActiveMQ server thingy). Pretty slick on how portable Java/JMS makes this between JMS service providers.


This would largely depend on the authorizations. As I work mostly with a privileged user, I never have to define the topic object in JMS. I just give it the topic string. Now you will have to define the subscription queue, if you wish to use one in your subscription...

The definition of a Topic object is mostly an authorization thing when looking at JMS. I thought the base API would allow you the same latitude when using the topic string vs the Topic Object. If you wish to use a topic object or an alias to a Topic, the corresponding topic object needs indeed to be defined on the server first.

If you wish to give specific authorizations at a topic (string) level, you will have to define the corresponding Topic Object and run the authorizations against that Topic Object.


_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon May 16, 2016 5:07 am    Post subject: Re: Sample MQPubSubApiSample throws RC 2085 Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
The definition of a Topic object is mostly an authorization thing when looking at JMS. I thought the base API would allow you the same latitude when using the topic string vs the Topic Object. If you wish to use a topic object or an alias to a Topic, the corresponding topic object needs indeed to be defined on the server first.


A Topic Object is both a point of authorization and also a point of administrative control.

It allows for applications to be ignorant of the entire topic tree structure and gives them room to specify shorter topic strings. So an administrator can define a topic object with a topic string of "Company/Region/Store/BusinessCategory/Application/", and then an application only has to know the name of the Topic Object and "Service/Register#/UserId". As an example.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed May 18, 2016 7:32 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

hughson wrote:
We haven't heard from Roger for a while. Are you all fixed now Roger?

Ah, life got in the way, so I'm now back to this and no, I still confused. Dave Ware sent me some links to postings: blog and a video but it left me still scratching my head.

I can't figure out how to define a topic object.
i.e.
Code:
DEFINE TOPIC(WC.TEAMS) TOPICSTR('/WorldCup/Teams') DEFPSIST(YES)

So 'WC.TEAMS' is the topic and '/WorldCup/Teams' is the topic string but I cannot find anywhere in the MQ KnowLedge Center where you define topic object.

Obviously, I'm missing something obvious but I have no idea what it is.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Wed May 18, 2016 7:37 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

WC.TEAMS is the name of the Topic Object.

Like "DEFINE QLOCAL(THIS.IS.A.QUEUE)" creates a queue named 'THIS.IS.A.QUEUE'.

The app would then open topic 'WC.TEAMS' and then publish to topic '/ManU/Must/Die', or whatever...

This would cause messages to be published to '/WorldCup/Teams/ManU/Must/Die'

Make more sense?

You might also look at Chris Frank's presentations from some MQ conference... what was that called again?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed May 18, 2016 7:49 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

Hi,

Really!?!

The manual for MQSC Define Topic says:
Quote:
(topic-name)
Name of the IBM MQ topic definition (see Rules for naming IBM MQ objects ). The maximum length is 48 characters.

The name must not be the same as any other topic definition currently defined on this queue manager (unless REPLACE is specified).

It doesn't say anything about the 'topic-name' being the 'topic object'.

I've never created any Pub/Sub stuff, so are you saying that if I issue the following MQSC then the sample will work?

Code:
DEFINE TOPIC('myTopicObject') TOPICSTR('/Test/Roger')

Or do I need to do something to create the topic string of '/Test/Roger' ??

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Wed May 18, 2016 8:05 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Easy enough to run the MQSC and find out what it does..

But yes, the "(topic-name) " is the name of the Topic Object. Not any part of the topic string used in the publish/subscribe.

The app would issue an MQOPEN to the (topic-name), or put it in the TCF or etc...
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » Sample MQPubSubApiSample throws RC 2085
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.