Getting the error "Please define a receive (response) queue for the current resource before calling this method"

73 Views Asked by At

I am trying to read messages from the queue using C#. I am able to to publish the message to the queue but not able to retrieve message from the queue. Below is the sample code snippet.

Messages are already there in some queue, some one publishing messages to the queue i want to read those messages from the same queue.

using (var broker = Current.Resources.Allocate(resourceConfigUri) as IMessageSource)
{
    if (broker != null)
    {
        Message messageResponse = null;

        // now get the message
        messageResponse = broker.Receive(); // getting the exception as mentioned.

        //  SerializationUtility.ToByteArray(this);

        string messageRequestString = SerializationUtility.ToXml(messageRequest.Body);
        string messageResponseString = SerializationUtility.ToXml(messageResponse.Body);

    }
}

Here is the error:

Please define a receive (response) queue for the current resource before calling this method: resource:Tibco:Ems:Queue:EventBus.
0

There are 0 best solutions below