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 » do any writeup exist regarding the connection to remote MQ ?

Post new topic  Reply to topic
 do any writeup exist regarding the connection to remote MQ ? « View previous topic :: View next topic » 
Author Message
santhosh_fischer
PostPosted: Thu Aug 05, 2004 2:58 am    Post subject: do any writeup exist regarding the connection to remote MQ ? Reply with quote

Novice

Joined: 05 Aug 2004
Posts: 13

hi everybody,
i want to know whether any documnetation or technical paper or any writeup exists about the connection details of JMS API to a remote MQ queue?
i understood that we should get connected to a qmnager and then make a queue connection and with that a session.and with session sender reciever all have to be made and it can be doe..
but the first step that is getting the Qmanager and establishing connection is the area where iam unaware,,
can it only done with JNDI look up...
how the naming of a remote MQ Manager is done in JNDI..i am not aware of JNDI techology...
if anyone can brief me with example or send me the link of some docs explaining that..i will be grateful to you...
..
Thanks in advance
Santhosh
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Aug 05, 2004 5:07 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Where have you looked?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bower5932
PostPosted: Thu Aug 05, 2004 5:50 am    Post subject: Reply with quote

Jedi Knight

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

I think that you want to define a qremote on your local system that points to the remote system. You then point your JMS destination to the qremote. I don't think the JMS needs to know anything about the queue being local or remote. The details on remote queues can be found in a number of places. I'd start with the intercommunication manual.

You can find some JMS samples at:

http://www.developer.ibm.com/tech/sampmq.html
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
santhosh_fischer
PostPosted: Thu Aug 05, 2004 10:34 pm    Post subject: JMS connection to MQ Reply with quote

Novice

Joined: 05 Aug 2004
Posts: 13

jefflowrey wrote:
Where have you looked?


i have tried a lot in google...
but all examples starts with the setting of intial context and their by referencing a JNDI ...
is there any alternate way that we can reference the queueConnectionFactory...
sorry if the question is too simple..
i'm new to this technology..JNDI/JMS/J2EE stuff...
...
so i want in detail about the setting of servers(whiat all servers have to be setup)..and installing a queue, whether MSMQ or MQ series , programmatically..and creatiing queues, putting and getting messages with JMS etc...
please help
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Aug 06, 2004 5:37 am    Post subject: Reply with quote

Jedi Knight

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

I think that you need to start by:

- install WebSphere MQ 5.3
- create a queue manager (see crtmqm command)
- create some queues (see runmqsc command)
- run JMSAdmin (see Using Java manual) to create a QCF and Q that point to the queue manager and queue that you just created
- try running one of the JMS related samples either on this site or on http://www.developer.ibm.com/tech/sampmq.html

You can also use some of the utilities to create your qmgr and queues rather than the command line.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
santhosh_fischer
PostPosted: Sat Aug 07, 2004 3:59 am    Post subject: Reply with quote

Novice

Joined: 05 Aug 2004
Posts: 13

i have installed MQ series trial version...
did managed to create a cluster, few Qmanagers and few queues under each queuemanager....
and using their gui for testing i managed to put and get messages into the queue....
..
now my doubt is that..

is it necessary that we should use the the com.ibm.mq class files??
if so where these package is located?? is there specific package for windows???? what are all the packages necessary for the proper functioning???

can we do all those functions using sun's JMS API???
can we give a direct reference to the queueConnectionFactory instead of going through JNDI??

please continue with ur valuable advise..
bye..
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Aug 07, 2004 7:10 am    Post subject: Reply with quote

Grand High Poobah

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

Quote:
is it necessary that we should use the the com.ibm.mq class files??
if so where these package is located?? is there specific package for windows???? what are all the packages necessary for the proper functioning???

The packages are under <mqroot>\java\lib.
Typicall is c:\program files\ibm\websphere mq\java\lib.
Be sure you installed the Java api when installing MQ.

Quote:
can we do all those functions using sun's JMS API???

You do not need to reference the com.ibm.mq.* package in your programs and can use javax.jms. but you will need to define a context (look up the file context worked fine for me)
You will need to have a number of the jars in your classpath. From memory:
com.ibm.mqjms.jar;com.ibm.mq.jar;jms.jar(javax.jms.*);jta.jar;connector.jar; file*.jar(file jndi lookup) etc...
Quote:

can we give a direct reference to the queueConnectionFactory instead of going through JNDI??

If you do not want to use JNDI but still use the JMS programming model, you will enter proprietary waters:
Look up the MQQueueConnectionFactory
and Session.createQueue() and MQQueue in the com.ibm.mq.jms package.

Have fun
Back to top
View user's profile Send private message Send e-mail
santhosh_fischer
PostPosted: Sun Aug 08, 2004 10:41 pm    Post subject: thanks for that valuable info....MR. fjb_saper Reply with quote

Novice

Joined: 05 Aug 2004
Posts: 13

i have managed to put and get messages from and to the queue which i have created on the MQ series installed on my system..
thanks for the information furnished by u ...

can i put and get a message on a queue which is in a different queue manager? i think its possible if they are in teh same clster and on the same system..
but is it possible if they are in same cluster( using same storage) but (MQ series) is on a diff machine...
..
i cant find any function in JMS API to connect to another QManager??
is it possible to create multiple QManagers in a single system??
...
expecting ur reply....
Santhosh
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Aug 09, 2004 6:17 am    Post subject: Reply with quote

Jedi Knight

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

You can definitely create mulitple queue managers on a single system. They just need to listen on different ports.

The JMS API doesn't have a 'connect to queue manager' API. You should be using JNDI to look up a QCF/TCF and Q/T. The QCF/TCF has the provider-specific connection details in it. This is where you would specify the name of the queue manager. If you are trying to run your program on a machine separate from the queue manager (ie, client connected), you would specify that your QCF/TCF has a transport of CLIENT. I'd suggest that you take a look at the JMSAdmin chapter of the Using Java manual.

As far as putting messages to a different queue manager, you might want to look at the Intercommunications manual where it discusses remote queues. You could also take a look at the Quick Beginnings manual. I believe it gives instructions on how to do it as one of the verification tests.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
fjb_saper
PostPosted: Mon Aug 09, 2004 2:24 pm    Post subject: Reply with quote

Grand High Poobah

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

One snag I ran into with multiple queue managers on the same box.
Trying to connect IN BINDINGS mode to multiple qmgrs from withing the same JVM was only possible if there was a clntconn channel defined to the other qmgrs.
There should however be no problem if you use client mode.
Just define 1 QCF/TCF per qmgr.

And like bower5932 said ... read the books.
They'll answer 90% of your questions

Have fun.
Back to top
View user's profile Send private message Send e-mail
santhosh_fischer
PostPosted: Wed Aug 11, 2004 12:02 am    Post subject: can any one please help on this code... Reply with quote

Novice

Joined: 05 Aug 2004
Posts: 13

i tried creating a meeage listener for a particular queue. but the code never calls the OnMessage ..
..this is working fine in synchronous way using the recieve function..
can anyone give me suggestions....
..
is there anything extra to do for putting a listener for a queue..
.
code is listed below..

-----------------------------------------------------------------------
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.*;
import javax.naming.*;
import com.ibm.mq.jms.*;
import com.ibm.mq.*;
/*
* Created on Aug 9, 2004
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/

/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class fiscQueueReciever {


String queueName = null;
Context jndiContext = null;
QueueConnectionFactory queueConnectionFactory = null;
QueueConnection queueConnection = null;
QueueSession queueSession = null;
Queue queue = null;
QueueSender queueSender = null;
QueueReceiver queueReceiver = null;
MQQueueManager queueManager=null;
TextMessage message=null;

final int NUM_MSGS=0;
public fiscQueueReciever()
{
try {

queueConnectionFactory= new MQQueueConnectionFactory();
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
queue=queueSession.createQueue( "testqueue1");



queueReceiver = queueSession.createReceiver(queue);
fiscListener fl=new fiscListener();
queueReceiver.setMessageListener(fl);
queueConnection.start();

//--------------------------------------------added listener and started
//connection---starting sending message-----------------------

queueSender = queueSession.createSender(queue);
message = queueSession.createTextMessage();
for (int i = 0; i < 1; i++) {
message.setText("This is sample message " + (i + 1));
System.out.println("Sending message: " + message.getText());
queueSender.send(message);
}



} catch (JMSException e) {
System.out.println("Exception occurred: " +
e.toString());
} catch (Exception se){
System.out.println(" last Exception occurred: " +
se.toString());


} finally {
// if (queueConnection != null) {
// try {
// queueConnection.close();
// } catch (JMSException e) {}
// }
}
}

*/

public static void main (String[] args)
{
fiscQueueReciever fqr=new fiscQueueReciever();




}

}//class

class fiscListener implements MessageListener
{
public void onMessage(Message arg0) {
TextMessage message = null;
Message m=null;
m=arg0;

try
{
System.out.println("entered");
if (m != null) {
if (m instanceof TextMessage)
{
message = (TextMessage) m;
System.out.println("Reading message: " +message.getText());
}
}

} catch (JMSException e) {
System.out.println("Exception occurred: " + e.toString());
} catch (Exception se){
System.out.println(" last Exception occurred: " + se.toString());
}



}//onMessage
}
----------------------------------------------------------------
pls give me soem suggestions..or point out my mistake.....
thanks in advance
Santhosh
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 » do any writeup exist regarding the connection to remote MQ ?
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.