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 IndexGeneral IBM MQ SupportApache qpid and IBM MQ 8.0.0.5

Post new topicReply to topic
Apache qpid and IBM MQ 8.0.0.5 View previous topic :: View next topic
Author Message
riyaz_tak
PostPosted: Mon Aug 03, 2020 6:00 am Post subject: Apache qpid and IBM MQ 8.0.0.5 Reply with quote

Voyager

Joined: 05 Jan 2012
Posts: 84

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
View user's profile Send private message
bruce2359
PostPosted: Mon Aug 03, 2020 7:07 am Post subject: Re: Apache qpid and IBM MQ 8.0.0.5 Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 8799
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?
_________________
My life flows on in endless song;
How can I keep from singing?
Back to top
View user's profile Send private message
riyaz_tak
PostPosted: Mon Aug 03, 2020 8:40 am Post subject: Reply with quote

Voyager

Joined: 05 Jan 2012
Posts: 84

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
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexGeneral IBM MQ SupportApache qpid and IBM MQ 8.0.0.5
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.