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 » Newbie questions...

Post new topic  Reply to topic
 Newbie questions... « View previous topic :: View next topic » 
Author Message
Teo
PostPosted: Tue Aug 24, 2004 8:25 am    Post subject: Newbie questions... Reply with quote

Newbie

Joined: 24 Aug 2004
Posts: 6

Hey hey ppl

I'm new to Websphere MQ and trying to adapt a Java program that what previously using OpenJMS to transmit messages...

I've installed the WebsphereMQ server, created a Queue Manager and a Queue, and managed to get the PTPSample01 to work with the -nojndi command line, but I was wondering how to get it to work with a remote WebsphereMQ server...

Actually, I don't quite understand the link between my program and the server, since I never specified any URL or anything so my program knows where the queue actually is... it seems a bit magical to me

- Does the -nojndi command line work only locally ?
- Do I have to use jndi if I plan on using a remote websphere server (without keeping one on my machine) ?
- And if so, could anyone give me a hint on how to setup a jndi (with OpenJMS the jndi was embedded in the OpenJMS server) ?

Thanks in advance, and sorry if all these questions have been answered before, but I searched the forum and wasn't able to find a thread answering them...

Matt
Back to top
View user's profile Send private message
bower5932
PostPosted: Tue Aug 24, 2004 10:15 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

If you want to talk to a remote queue manager, you can do it with the nojndi flag. You have to specify a host, port, and channel where the queue manager can be found. There are details in the Using Java manual in Chapter 4.

However, if you want your program to not be WMQ specific, you'll probably use something (JMSAdmin, WAS Admin Console) to define your JMS resources. Using these tools, you would define a connection factory and give it the properties (ie, host, port, channel, qmgr name) that it needs to talk to the qmgr. Your program would then use JNDI to look up the connection factory.

There are a couple of publish/subscribe samples at:

http://www.developer.ibm.com/tech/sampmq.html

and some details on how to run them at:

http://www.developer.ibm.com/tech/faq/individual?oid=2:83352

Good luck and welcome aboard.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
vennela
PostPosted: Tue Aug 24, 2004 1:32 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Quote:
you'll probably use something (JMSAdmin, WAS Admin Console)

If you don't have enough experience with either of the above (JMSAdmin or WAS admin console), then another idea is to use the WMQ initial context factory. For that you need to get the support pac
ME01: WebSphere MQ - Initial Context Factory
The prereq to this is MS0B.
Basically you will have to download the above two support pacs from the following site.

http://www-306.ibm.com/software/integration/support/supportpacs/category.html#cat1

Put the two jars in the CLASSPATH.
The two jar files are
com.ibm.mq.pcf.jar (the jar from MS0B)
mqcontext.jar (the jr from ME01)


Use the url as the QMGR name and icf mentioned in the support pacs. You can use the PTPSample01 for the same.

The icf wuld be
com.ibm.mq.jms.context.WMQInitialContextFactory and the URL would be your QMGR name

Assuming you have QMGR1 as the name of your QMGR

Code:
java PTPSample01 -url QMGR1 -icf com.ibm.mq.jms.context.WMQInitialContextFactory
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Teo
PostPosted: Wed Aug 25, 2004 12:47 am    Post subject: Reply with quote

Newbie

Joined: 24 Aug 2004
Posts: 6

Thanx a lot !

I'll try using the WMQInitialContextFactory since I need to get it working quickly for testing purposes...
Back to top
View user's profile Send private message
Teo
PostPosted: Wed Aug 25, 2004 1:47 am    Post subject: Reply with quote

Newbie

Joined: 24 Aug 2004
Posts: 6

Ok, I managed to get the PTPSample01 program to work fine with a local WMQ server, using the WMQInitialContextFactory, but I still don't understand how to work with a remote server...

I had a look at the Chapter 4 of the 'Using Java' manual but it didn't really help...

Basically my question is : where should I supply the location information for the remote server ? I'm afraid it won't work if QMGR1 is on a remote WMQ server, and if I run the program this way :
Code:
java PTPSample01 -url QMGR1 -icf com.ibm.mq.jms.context.WMQInitialContextFactory
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Aug 25, 2004 5:30 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I'll have to plead ignorance on ME01. However, I would suspect that it allows you to specify a channel, port, hostname to go with a transport of client (rather than bindings)?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Teo
PostPosted: Wed Aug 25, 2004 6:29 am    Post subject: Reply with quote

Newbie

Joined: 24 Aug 2004
Posts: 6

Hello again,

I found this in the ME01 doc :

Quote:
Connections to JNDI repositories are created by constructing a properties
Hashtable and populating it with certain values. The two important values are
the InitialContextFactory property and the Provider URL property and these
should be set to:
INITIAL_CONTEXT_FACTORY: 'com.ibm.mq.jms.context.WMQInitialContextFactory'

The provider URL is composed differently depending on how you wish to connect
to the queue manager:

For a bindings connect:

PROVIDER_URL: <queue manager name>
E.g. 'MYQM1'

For a client connect:

PROVIDER_URL: <Hostname>:<port>/<SVRCONN Channel Name>
E.g. 'qm.ibm.com:1414/SYSTEM.DEF.SVRCONN'

Once you have populated your properties Hashtable with the above information, a
call to new InitialContext(properties) will connect to the queue manager and
allow you to start performing JNDI operations on it.


And the following example is given :

Quote:
In this example, we will connect using bindings:

java.util.Hashtable props = new Hashtable();
props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.mq.jms.context.WMQInitialContextFactory");
props.put(javax.naming.Context.PROVIDER_URL,
"MYQM1");

try {
javax.naming.Context qmContext = new javax.naming.InitialContext(props);
}
...


Now I think I'm beginning to get it, but there's still some things I can't figure out :
- what is a <SVRCONN Channel Name> ? Where can I find it ?
- how do I know which port my QM is on ?

Thanks in advance, I know I'm close to the solution now...
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 25, 2004 6:56 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Teo wrote:

Now I think I'm beginning to get it, but there's still some things I can't figure out :
- what is a <SVRCONN Channel Name> ? Where can I find it ?
- how do I know which port my QM is on ?

Ask your MQ Administrator.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Teo
PostPosted: Wed Aug 25, 2004 7:01 am    Post subject: Reply with quote

Newbie

Joined: 24 Aug 2004
Posts: 6

There is no MQ administrator for now...

I'm running a demo version of the WMQ server on my machine right now, and we have another demo version on another machine...
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Aug 25, 2004 7:05 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

If you are just using a demo system, then you probably want to use the SYSTEM.DEF.SVRCONN. A SVRCONN channel is a server connection channel which is used by a client to talk to a qmgr. You can get details in the Clients manual.

Also, you can't get your client to connect unless a listener is running. You can search for runmqlsr on this site and you should get the info you need.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
jefflowrey
PostPosted: Wed Aug 25, 2004 7:05 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Ahh. So you are your MQ Administrator!

Use "SYSTEM.DEF.SVRCONN" as the name of your server connection channel. You can see this in WebSphere MQ Explorer under channels if you have enabled it to show system objects.

The port you will need to use is the port that is assigned to your listener. This was either assigned when you created the queue manager or when you created the listener (if done separately). To find out what port is being used, you can use the MQServices MMC and look at the properties of the Listener under your queue manager.

If you're not running on Windows, there are different approaches to finding this information - but SYSTEM.DEF.SVRCONN should still exist.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Teo
PostPosted: Wed Aug 25, 2004 7:44 am    Post subject: Reply with quote

Newbie

Joined: 24 Aug 2004
Posts: 6

YEEPEEYEAH !!
It works !! Thanks !!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Newbie questions...
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.