Skip to content
Permalink
Browse files
Wait for message receive.
  • Loading branch information
Jim Gomes committed Mar 13, 2012
1 parent 6b96362 commit 5bcebeb02792abb49da7bee40835a469a7818cc8
Showing 1 changed file with 4 additions and 2 deletions.
@@ -42,6 +42,7 @@ public class MessageConsumer : IMessageConsumer
/// Context binding string
/// </summary>
private string contextBinding;
private Queue destination;
private event MessageListener listener;
private int listenerCount = 0;
private Thread asyncDeliveryThread = null;
@@ -73,6 +74,7 @@ public MessageConsumer(Session session, AcknowledgementMode acknowledgementMode,
string clientId = session.Connection.ClientId;

this.contextBinding = session.Connection.BrokerUri.LocalPath;
this.destination = new Queue(this.contextBinding);
if(!string.IsNullOrEmpty(clientId))
{
this.messageSubscriber.StringToIdentity(clientId, Encoding.Unicode);
@@ -115,7 +117,7 @@ public MessageConsumer(Session session, AcknowledgementMode acknowledgementMode,
public IMessage Receive()
{
// TODO: Support decoding of all message types + all meta data (e.g., headers and properties)
return ToNmsMessage(messageSubscriber.Recv(Encoding.ASCII, ZSendRecvOpt.NOBLOCK));
return ToNmsMessage(messageSubscriber.Recv(Encoding.ASCII, ZSendRecvOpt.NONE));
}

/// <summary>
@@ -248,7 +250,7 @@ protected virtual IMessage ToNmsMessage(string messageText)
try
{
nmsMessage.NMSMessageId = "";
nmsMessage.NMSDestination = new Queue(contextBinding);
nmsMessage.NMSDestination = this.destination;
nmsMessage.NMSDeliveryMode = MsgDeliveryMode.NonPersistent;
nmsMessage.NMSPriority = MsgPriority.Normal;
nmsMessage.NMSTimestamp = DateTime.Now;

0 comments on commit 5bcebeb

Please sign in to comment.