One MSMQ Queue works but another one doesn't
-
Hi everyone, I'm so confused right now I'm hardly sure where to begin. I've been tasked with writing an application using MSMQ. Basically, the app listens to a file folder, notices when a file's been added, sends a message to a router queue which then figures out what to do and sends a message to the appropriate processing queue. The router queue is receiving messages and it seems to be sending them on to the processing queue but the processing queue never receives the message. I've tried everything I can think of to get this working but cannot seem to do so and have no clue why not. No matter what I try, the processing queue never seems to receive the message that was sent to it. Here's how the main program creates the router object (this is the one that works):
Private Sub StartRouter(ByVal myNode As XmlNode) Try m\_RouterQueueName = myNode.Attributes("queuename").Value TheRouter = New Router(m\_RouterQueueName) AddHandler TheRouter.onRouterStarted, AddressOf LogActivity AddHandler TheRouter.onRouterMessageReceived, AddressOf LogActivity AddHandler TheRouter.onRouterError, AddressOf LogError Catch ex As Exception LogError(ex) End Try End Sub
And here's the constructor in the router object:
Public Sub New(ByVal QueueName As String)
Try
m_QueueName = QueueName
StartListening()
Catch ex As Exception
RaiseEvent onRouterError(ex)
End Try
End SubYou'll notice that it has a "start listening" routine. Here is that routine:
Private Sub StartListening() myReceiveQueue = New MessageQueue(m\_QueueName, QueueAccessMode.SendAndReceive, False, QueueAccessMode.SendAndReceive) Try 'myReceiveQueue = New MessageQueue() 'myReceiveQueue.Path = m\_QueueName myReceiveQueue.Formatter = New XmlMessageFormatter(New Type() {GetType(System.String)}) myReceiveQueue.UseJournalQueue = True RaiseEvent onRouterStarted("Router listening to " & m\_QueueName, "Started") AddHandler myReceiveQueue.ReceiveCompleted, AddressOf MSMQ\_ReceiveCompleted myResult = myReceiveQueue.BeginReceive() Catch ex As Exception RaiseEvent onRouterError(ex) End Try End Sub
Now as to the processor (this is the part that's not working), here's how the calling program