Search code examples
.netmsmqsystem.messaging

system.messaging message not arriving


My message is not arriving at the destination. I'm not getting an error. It does not show up in the journal at the receiving end even though journaling is turned on there. Permissions at destination queue are set to Everyone Full Control. Diagnostics at the destination msmq service show msmq ping is good. Other apps have successfully written to this queue earlier this month. It shows up in my journal on my end (sending end). It is not showing up in dead letter or transactional dead letter at my end or the receiving end. I double checked the queue name. I found no Google hits or other SO questions about this. I searched broadly, for "system.messaging" trouble, or "system.messaging" problem, and some other more specific searches.

In this particular case I am using the ActiveX Formatter.

  Public Shared Sub Send(QueuePath As String, Label As String, Body As String, FormatterType As FormatterTypes)

    Dim MessageQueue As MessageQueue
    Dim MessageQueueTransaction As New MessageQueueTransaction
    Try
      If MessageQueue.Exists(QueuePath) Then 
        'creates an instance MessageQueue, which points 
        'to the already existing MessageQueue
        MessageQueue = New MessageQueue(QueuePath)
        If Not MessageQueue.CanWrite Then Exit Sub
      Else
        Throw New ArgumentException(String.Format("Queue does not exist '{0}'", QueuePath), "QueuePath")
      End If
      Dim Formatter As IMessageFormatter
      Select Case FormatterType
        Case FormatterTypes.ActiveX
          Formatter = New ActiveXMessageFormatter
        Case FormatterTypes.Binary
          Formatter = New BinaryMessageFormatter
        Case FormatterTypes.Xml
          Formatter = New XmlMessageFormatter
      End Select
      Using Message As New Message(Body, Formatter)
        Message.Label = Label
        Message.AcknowledgeType = AcknowledgeTypes.FullReachQueue
        Message.UseJournalQueue = True
        Message.UseDeadLetterQueue = True
        MessageQueueTransaction.Begin()
        MessageQueue.Send(Message, MessageQueueTransaction)
        MessageQueueTransaction.Commit()
      End Using

    Catch ex As MessageQueueException
      MessageQueueTransaction.Abort()
    Finally
      MessageQueueTransaction.Dispose()
    End Try
  End Sub

Solution

  • The message was there at the receiver, but was no where to be seen in the journal queue.

    Purging the journal queue enabled new messages from this app to be seen finally.

    The journal was enabled and not limited by size, so I don't know why it was refusing to show new messages. That is a seperate issue I suppose.