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 » Am able to send the message but not able to receive it..

Post new topic  Reply to topic
 Am able to send the message but not able to receive it.. « View previous topic :: View next topic » 
Author Message
SG
PostPosted: Mon Mar 11, 2002 8:14 am    Post subject: Reply with quote

Newbie

Joined: 10 Mar 2002
Posts: 2

hi

I am having this strange prob for last one day. Till yesterday, I was able to send and recieve messages properly with this code.
MQEnvironment.hostname = "usnt_loanergaur";
//MQEnvironment.channel = "stwdReceiverChanel";
MQEnvironment.port = 1414;
// get JNDI context
InitialContext ctx = new InitialContext();

// get local JNDI environment
Context env = (Context) ctx.lookup("java:comp/env");

// get queue connection factory
QueueConnectionFactory qcf = (QueueConnectionFactory) env.lookup("myQCF");

// create a connection
QueueConnection qc = qcf.createQueueConnection();

// create a session.
QueueSession session1 =
qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

// get queue
Queue q = (Queue) env.lookup("myQ");

// create a queue sender for the queue
QueueSender queueSender = session1.createSender(q);

// Create a QueueReceiver in the same way
out.println( "Creating a QueueReceiver");
QueueReceiver queueReceiver = session1.createReceiver(q);

// The session is used to create messages, so create an empty
// TextMessage and fill it with some data
String outString = "khsadfjksdf";
out.println( "Creating a TextMessage" );
TextMessage outMessage = session1.createTextMessage();
//out.println("Adding Text");
outMessage.setText(outString);

// Ask the QueueSender to send the message we have created
//out.println( "Sending the message to " + q.getQueueName() );
queueSender.send(outMessage);

// Now use the QueueReceiver to retrieve the message, blocking
// for a maximum of 1000ms. The receive call returns when the
// message arrives, or after 1000ms, whichever is sooner
out.println( "Reading the message back again" );
Message inMessage = queueReceiver.receive(10000);


But, after creating a new queuemanager and a new queue in it, I am not able to recieve messages. Its sending messages properly. Any idea..

thanks in advance
SG
Back to top
View user's profile Send private message
kolban
PostPosted: Mon Mar 11, 2002 5:55 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

What is the nature of the error (if any) reported. I think we will need some additional information to assist.
Back to top
View user's profile Send private message
abmanesh
PostPosted: Tue Mar 12, 2002 6:31 am    Post subject: Reply with quote

Apprentice

Joined: 06 Nov 2001
Posts: 39

Hi,
One obvious thing I noticed in the code was that, after obtaining a QueueConnection the connection is not started. In the JMS implementation the Connections are created in a stopped mode. You have to start them explicitly using the start() method on the Connection object.
Back to top
View user's profile Send private message Send e-mail
SG
PostPosted: Tue Mar 12, 2002 6:46 am    Post subject: Reply with quote

Newbie

Joined: 10 Mar 2002
Posts: 2

yes
start on conn was missing
thats w3hat I was wondering that what can be missing as I have trie dit before.

but I am still wondering that how was I able to send the messages though..

thanks for help.

SG
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 » Am able to send the message but not able to receive it..
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.