|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Apache qpid and IBM MQ 8.0.0.5 |
« View previous topic :: View next topic » |
Author |
Message
|
riyaz_tak |
Posted: Mon Aug 03, 2020 6:00 am Post subject: Apache qpid and IBM MQ 8.0.0.5 |
|
|
Voyager
Joined: 05 Jan 2012 Posts: 92
|
Hi All,
IBM MQ 8.0.0.5
OS Solaris 10
JAVA 8
I have created on AMQP channel on port 5672 .
define CHANNEL(TO.TEST.AMQP) CHLTYPE(AMQP) MCAUSER('xxxx') SSLCAUTH(optional).
I created a topic as well .
def topic (TOTOPIC) TOPICSTR('toTopic').
I am using sample program using JMS and Apache qpid to send /receive messages.
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Topic;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.lang.String;
import javax.jms.Destination;
import javax.naming.Context;
import org.apache.qpid.jms.JmsConnectionFactory;
import javax.jms.DeliveryMode;
import javax.naming.InitialContext;
import javax.jms.Message;
public class AMQPQueueExample {
private static final int DELIVERY_MODE = DeliveryMode.PERSISTENT;
public static void main(String[] args) {
Connection connection = null;
try {
Context context = new InitialContext();
ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("myFactoryLookup");
Destination queue = (Destination) context.lookup("myQueueLookup");
// Step 1. Create an amqp qpid 1.0 connection
connection = connectionFactory.createConnection();
// Step 2. Create a session
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Step 3. Create a sender
MessageProducer sender = session.createProducer(queue);
// Step 4. send a few simple message
TextMessage message = session.createTextMessage("Text!");
sender.send(message, DELIVERY_MODE, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
connection.start();
// Step 5. create a moving receiver, this means the message will be removed from the queue
MessageConsumer consumer = session.createConsumer(queue);
// Step 7. receive the simple message
TextMessage m = (TextMessage) consumer.receive(5000);
System.out.println("message = " + m.Text());
}catch(Exception e){
e.printStackTrace();
}
finally {
if (connection != null) {
// Step 9. close the connection
try{
connection.close();
}catch (Exception e){
e.printStackTrace();
}
}
}
}
}
I am using Apache qpid .
My jndi.propery file :
java.naming.factory.initial = org.apache.qpid.jms.jndi.JmsInitialContextFactory
queue.myQueueLookup = TOTOPIC
topic.myTopicLookup = TOTOPIC
When i compile and run the program i get below output :
1468 [AmqpProvider 1):[amqp://localhost:xxxx]] INFO org.apache.qpid.jms.sasl.SaslMechanismFinder - Best match for SASL auth was: SASL-ANONYMOUS
1543 [AmqpProvider 1):[amqp://localhost:xxxx]] INFO org.apache.qpid.jms.JmsConnection - Connection ID:2ad054a7-e484-45d0-9974-70eb7ebf2911:1 connected to remote Broker: amqp://localhost:xxxx
I don't get any error while sending message but there is no entry in MQ log as well.
When I try to receive the message , i get null.
message = null |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Aug 03, 2020 7:07 am Post subject: Re: Apache qpid and IBM MQ 8.0.0.5 |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
riyaz_tak wrote: |
I don't get any error while sending message but there is no entry in MQ log as well.
When I try to receive the message , i get null.
message = null |
MQ issues ReturnCodes and CompletionCodes for every call - errors and successes. Did your app catch any CC/RC's? Where exactly did you look for errors? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
riyaz_tak |
Posted: Mon Aug 03, 2020 8:40 am Post subject: |
|
|
Voyager
Joined: 05 Jan 2012 Posts: 92
|
I am not getting any error at all.
Sender is sending message without throwing error although I can't see that message on mq log or on topic.
Receiver is not able to fetch the message which I sent and returning null.
There is no mq log generated at all so I believe what I am trying to achieve using Qpid and IBM MQ is not correct and something is definitely missing. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|