我正在尝试使用 C# 从队列中读取消息。我能够将消息发布到队列,但无法从队列中检索消息。下面是示例代码片段。
消息已经存在于某个队列中,有人将消息发布到队列中,我想从同一个队列中读取这些消息。
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);
}
}
这是错误:
Please define a receive (response) queue for the current resource before calling this method: resource:Tibco:Ems:Queue:EventBus.