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 API Support » How to publish JMS message to topic using .net client

Post new topic  Reply to topic
 How to publish JMS message to topic using .net client « View previous topic :: View next topic » 
Author Message
the_weary_programmer
PostPosted: Sun May 23, 2021 5:16 pm    Post subject: How to publish JMS message to topic using .net client Reply with quote

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
View user's profile Send private message
bruce2359
PostPosted: Sun May 23, 2021 5:59 pm    Post subject: Re: How to publish JMS message to topic using .net client Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
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
View user's profile Send private message
hughson
PostPosted: Mon May 24, 2021 3:45 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
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
View user's profile Send private message Visit poster's website
the_weary_programmer
PostPosted: Mon May 24, 2021 8:35 am    Post subject: Reply with quote

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
View user's profile Send private message
the_weary_programmer
PostPosted: Mon May 24, 2021 8:37 am    Post subject: Re: How to publish JMS message to topic using .net client Reply with quote

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
View user's profile Send private message
hughson
PostPosted: Mon May 24, 2021 1:11 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
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
View user's profile Send private message Visit poster's website
the_weary_programmer
PostPosted: Mon May 24, 2021 1:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
hughson
PostPosted: Mon May 24, 2021 6:59 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » How to publish JMS message to topic using .net client
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.