Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. One MSMQ Queue works but another one doesn't

One MSMQ Queue works but another one doesn't

Scheduled Pinned Locked Moved .NET (Core and Framework)
data-structures
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hypermommy
    wrote on last edited by
    #1

    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 Sub

    You'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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups