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. Visual Basic
  4. Windows Message Queue Service (VB.NET)

Windows Message Queue Service (VB.NET)

Scheduled Pinned Locked Moved Visual Basic
csharpdata-structureshelp
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.
  • N Offline
    N Offline
    Nic Rowan
    wrote on last edited by
    #1

    Heya, I'm trying To create a windows service that picks messages off of a MS message queue and send them to a GSM modem. I can post a message to the queue with a standard Windows app so there's no problem connecting to the queue. The problem is, I've made a service that finds the queue and begins receiving, it just never calls the ReceiveCompleted event, or if it does I never see it happen. I know it reads the queue once because if there is a message on the queue it disappears as soon as the service is started. If I add a message after that nothing happens. The code is as follows: Private Sub HookQueue() Try ' Initialise our queue SMSMessageQueue = New MessageQueue(".\private$\SMSMessaging") SMSMessageQueue.Formatter = New System.Messaging.XmlMessageFormatter(New String() {"LAB.Messaging.SMS.SMSMessage"}) AddHandler SMSMessageQueue.ReceiveCompleted, AddressOf SMSMessageReceived SMSMessageQueue.BeginReceive() Catch exp As MessageQueueException EventLog.WriteEntry(exp.Message) Catch exp As Exception EventLog.WriteEntry(exp.Message) End Try End SubAnd the event code: Private Sub SMSMessageReceived(ByVal sender As Object, ByVal e As System.Messaging.ReceiveCompletedEventArgs) Handles SMSMessageQueue.ReceiveCompleted Try Dim SMSMessage As Message = sender.EndReceive(e.AsyncResult) 'SMSMessageQueue Dim oMessage As LAB.Messaging.SMS.SMSMessage = CType(SMSMessage.Body, LAB.Messaging.SMS.SMSMessage) 'TODO: Send message to GSM Modem here SMSMessageQueue.BeginReceive() Catch exp As MessageQueueException EventLog.WriteEntry(exp.Message) Catch exp As Exception EventLog.WriteEntry(exp.Message) End Try End Sub
    I can't think of anything I'm doing wrong. Thanks :) Nicholas Rowan


    The man who smiles when things go wrong has thought of someone he can blame it on. If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.


    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