Author |
Message
|
the_weary_programmer |
Posted: Sun May 23, 2021 5:16 pm Post subject: How to publish JMS message to topic using .net client |
|
|
Newbie
Joined: 23 May 2021 Posts: 4
|
I need to be able publish message to mq using the IBM .net client. Here is the a snippet of the code I am currently unable to get to work. Currently, this code "works", as in it runs with no errors. However, once I check if the messages have been delivered I see no logs or anything that indicates it was succesfully delivered.
Code: |
try
{
using(IConnection connection = connectionFactory.CreateConnection())
{
using(ISession session = connetion.CreateSession(fals, AckknowledgeMode.AutoAckknowledge)
{
using(IDestination destination = CreateMqDestination(session, topicName)
{
using(IMessageProducer producer = session.CreateProducer(destination))
{
connection.Start();
IMessage msg;
msg = session.CreateTextMessage(mqMessage);
msg.JMSType = topicName;
producer.Send(msg);
}
}
}
}
public IDestination CreateMQDestination(session, topicName)
{
IDestination dest = session.CreateTopic(topicName);
dest.SetIntProperty(XMSC.DELIVERY_MODE, XMSC.DELIVERY_AS_DEST);
dest.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, XMSC.WMQ_TARGET_DEST_JMS);
return dest;
} |
|
|
Back to top |
|
 |
bruce2359 |
Posted: Sun May 23, 2021 5:59 pm Post subject: Re: How to publish JMS message to topic using .net client |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
the_weary_programmer wrote: |
... However, once I check if the messages have been delivered I see no logs or anything that indicates it was succesfully delivered. |
Were messages delivered or not? - you didn't specify. You merely said you checked if messages were delivered.
I'll presume that messages were delivered. MQ doesn't log message delivery. _________________ 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 |
|
 |
hughson |
Posted: Mon May 24, 2021 3:45 am Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
Do you have any subscribers to receive this message?
If not and you are are just testing the publisher application for the moment, you could create an admin subscriber with a queue for the messages to go to and then you would be able to know that it had worked.
Let me know if you need further help doing this.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
the_weary_programmer |
Posted: Mon May 24, 2021 8:35 am Post subject: |
|
|
Newbie
Joined: 23 May 2021 Posts: 4
|
hughson wrote: |
Do you have any subscribers to receive this message?
If not and you are are just testing the publisher application for the moment, you could create an admin subscriber with a queue for the messages to go to and then you would be able to know that it had worked.
Let me know if you need further help doing this.
Cheers,
Morag |
Hello, we have an internal application written in .NET that has an OnMessage listener. I’m not sure if that qualifies as a subscriber but I think it does. The message, I don’t think, was delivered because none the application logs don’t indicate that anything was captured, for what it’s worth. |
|
Back to top |
|
 |
the_weary_programmer |
Posted: Mon May 24, 2021 8:37 am Post subject: Re: How to publish JMS message to topic using .net client |
|
|
Newbie
Joined: 23 May 2021 Posts: 4
|
bruce2359 wrote: |
the_weary_programmer wrote: |
... However, once I check if the messages have been delivered I see no logs or anything that indicates it was succesfully delivered. |
Were messages delivered or not? - you didn't specify. You merely said you checked if messages were delivered.
I'll presume that messages were delivered. MQ doesn't log message delivery. |
Hello, sorry should have clarified. I’m pretty sure they were not delivered. We have an internal application that logs messages with the OnMessage listener. None of the application logs showed the test message I was publishing. |
|
Back to top |
|
 |
hughson |
Posted: Mon May 24, 2021 1:11 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
the_weary_programmer wrote: |
Hello, we have an internal application written in .NET that has an OnMessage listener. I'm not sure if that qualifies as a subscriber but I think it does. |
It counts as a subscriber if it is using the same topic. Is it?
If you're unsure use the following MQSC command to confirm.
Code: |
DISPLAY TPSTATUS(your-topic) TYPE(SUB) |
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
the_weary_programmer |
Posted: Mon May 24, 2021 1:42 pm Post subject: |
|
|
Newbie
Joined: 23 May 2021 Posts: 4
|
hughson wrote: |
the_weary_programmer wrote: |
Hello, we have an internal application written in .NET that has an OnMessage listener. I'm not sure if that qualifies as a subscriber but I think it does. |
It counts as a subscriber if it is using the same topic. Is it?
If you're unsure use the following MQSC command to confirm.
Code: |
DISPLAY TPSTATUS(your-topic) TYPE(SUB) |
Cheers,
Morag |
Yeah the topics are the same so no issue there. Still not quite sure why the queue isn't receiving the messages that I am publishing. Is there any properties I am missing with regards to the destination? |
|
Back to top |
|
 |
hughson |
Posted: Mon May 24, 2021 6:59 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
the_weary_programmer wrote: |
Still not quite sure why the queue isn't receiving the messages that I am publishing. |
To discover whether the problem is with the publishing application or the subscribing application, I would recommend making a admin subscription. This will then allow you to know where to concentrate your efforts.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
|