MSMQ

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • William Ryan

    #1

    MSMQ

    I'm starting to play with MSMQ and have a really newbie question...

    I can effectively write to my Queue with no problem. However, what event is
    raised when something is added to the queue. Currently, I'm polling the
    queue to see if it has anything in it and then processing accordingly. But
    that seems like an awkward way to handle messages b/c I might interrogate
    the queue x number of times when there's nothing in it. If I could just
    wake up the client app when anything is added to the queue, it seems like
    it'd be much better solution.

    Is there a way to do this, namely, for the queue to send a notification that
    something has been added or that it has stuff in it?

    TIA,

    Bill

    --
    Cordially,

    W.G. Ryan
    dotnetguru@comc ast.nospam.net




  • Ali Mazaheri [MCAD]

    #2
    Re: MSMQ

    One way is to implement a windows service which incorporates Timer object
    for checking the Queue and notifies the other components in case of new
    message.

    "William Ryan" <dotnetguru@nos pam.comcast.net > wrote in message
    news:uWtcbumlDH A.1096@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I'm starting to play with MSMQ and have a really newbie question...
    >
    > I can effectively write to my Queue with no problem. However, what event[/color]
    is[color=blue]
    > raised when something is added to the queue. Currently, I'm polling the
    > queue to see if it has anything in it and then processing accordingly.[/color]
    But[color=blue]
    > that seems like an awkward way to handle messages b/c I might interrogate
    > the queue x number of times when there's nothing in it. If I could just
    > wake up the client app when anything is added to the queue, it seems like
    > it'd be much better solution.
    >
    > Is there a way to do this, namely, for the queue to send a notification[/color]
    that[color=blue]
    > something has been added or that it has stuff in it?
    >
    > TIA,
    >
    > Bill
    >
    > --
    > Cordially,
    >
    > W.G. Ryan
    > dotnetguru@comc ast.nospam.net
    > www.devbuzz.com
    > www.knowdotnet.com
    >
    >[/color]


    Comment

    • Willy Denoyette [MVP]

      #3
      Re: MSMQ

      Take a look at MSMQ triggers.

      Willy.

      "William Ryan" <dotnetguru@nos pam.comcast.net > wrote in message news:uWtcbumlDH A.1096@TK2MSFTN GP11.phx.gbl...[color=blue]
      > I'm starting to play with MSMQ and have a really newbie question...
      >
      > I can effectively write to my Queue with no problem. However, what event is
      > raised when something is added to the queue. Currently, I'm polling the
      > queue to see if it has anything in it and then processing accordingly. But
      > that seems like an awkward way to handle messages b/c I might interrogate
      > the queue x number of times when there's nothing in it. If I could just
      > wake up the client app when anything is added to the queue, it seems like
      > it'd be much better solution.
      >
      > Is there a way to do this, namely, for the queue to send a notification that
      > something has been added or that it has stuff in it?
      >
      > TIA,
      >
      > Bill
      >
      > --
      > Cordially,
      >
      > W.G. Ryan
      > dotnetguru@comc ast.nospam.net
      > www.devbuzz.com
      > www.knowdotnet.com
      >
      >[/color]


      Comment

      • William Ryan

        #4
        Re: MSMQ

        Ali:

        Thanks for the suggestion, that's actually what I have now....I have a
        background thread and a timer in it that's doing the polling , and it
        definitely works. I was just wondering if the Queue had anything inherent
        in it to notify me.


        BTW, I noticed you earned the MCAD. I've been thinking about it for a
        while...can you recommend any study material?

        Thanks again,

        Bill
        "Ali Mazaheri [MCAD]" <aemazaheriNOSP AM@NOSPAMhotmai l.com> wrote in message
        news:ep2TsvnlDH A.2528@TK2MSFTN GP10.phx.gbl...[color=blue]
        > One way is to implement a windows service which incorporates Timer object
        > for checking the Queue and notifies the other components in case of new
        > message.
        >
        > "William Ryan" <dotnetguru@nos pam.comcast.net > wrote in message
        > news:uWtcbumlDH A.1096@TK2MSFTN GP11.phx.gbl...[color=green]
        > > I'm starting to play with MSMQ and have a really newbie question...
        > >
        > > I can effectively write to my Queue with no problem. However, what[/color][/color]
        event[color=blue]
        > is[color=green]
        > > raised when something is added to the queue. Currently, I'm polling the
        > > queue to see if it has anything in it and then processing accordingly.[/color]
        > But[color=green]
        > > that seems like an awkward way to handle messages b/c I might[/color][/color]
        interrogate[color=blue][color=green]
        > > the queue x number of times when there's nothing in it. If I could just
        > > wake up the client app when anything is added to the queue, it seems[/color][/color]
        like[color=blue][color=green]
        > > it'd be much better solution.
        > >
        > > Is there a way to do this, namely, for the queue to send a notification[/color]
        > that[color=green]
        > > something has been added or that it has stuff in it?
        > >
        > > TIA,
        > >
        > > Bill
        > >
        > > --
        > > Cordially,
        > >
        > > W.G. Ryan
        > > dotnetguru@comc ast.nospam.net
        > > www.devbuzz.com
        > > www.knowdotnet.com
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • William Ryan

          #5
          Re: MSMQ

          That's exactly what I needed..... Many many thanks!
          "Willy Denoyette [MVP]" <willy.denoyett e@pandora.be> wrote in message
          news:%23UW00dol DHA.424@TK2MSFT NGP10.phx.gbl.. .[color=blue]
          > Take a look at MSMQ triggers.
          >
          > Willy.
          >
          > "William Ryan" <dotnetguru@nos pam.comcast.net > wrote in message[/color]
          news:uWtcbumlDH A.1096@TK2MSFTN GP11.phx.gbl...[color=blue][color=green]
          > > I'm starting to play with MSMQ and have a really newbie question...
          > >
          > > I can effectively write to my Queue with no problem. However, what[/color][/color]
          event is[color=blue][color=green]
          > > raised when something is added to the queue. Currently, I'm polling the
          > > queue to see if it has anything in it and then processing accordingly.[/color][/color]
          But[color=blue][color=green]
          > > that seems like an awkward way to handle messages b/c I might[/color][/color]
          interrogate[color=blue][color=green]
          > > the queue x number of times when there's nothing in it. If I could just
          > > wake up the client app when anything is added to the queue, it seems[/color][/color]
          like[color=blue][color=green]
          > > it'd be much better solution.
          > >
          > > Is there a way to do this, namely, for the queue to send a notification[/color][/color]
          that[color=blue][color=green]
          > > something has been added or that it has stuff in it?
          > >
          > > TIA,
          > >
          > > Bill
          > >
          > > --
          > > Cordially,
          > >
          > > W.G. Ryan
          > > dotnetguru@comc ast.nospam.net
          > > www.devbuzz.com
          > > www.knowdotnet.com
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Rolf Enidsson

            #6
            Re: MSMQ

            If you use .NET Framework (as I suspect so since you post here) you can use
            async programming. Look att BeginReceive / EndReceive in the MessageQueue
            class. Read more at
            http://msdn.microsoft.com/library/de...asp?frame=true

            In fact, that whole chapter might be interesting for you.
            http://msdn.microsoft.com/library/de...asp?frame=true

            Also there is at least one other article about MSMQ and services at
            http://msdn.microsoft.com/library/de...asp?frame=true


            "William Ryan" <dotnetguru@nos pam.comcast.net > wrote in message
            news:uWtcbumlDH A.1096@TK2MSFTN GP11.phx.gbl...[color=blue]
            > I'm starting to play with MSMQ and have a really newbie question...
            >
            > I can effectively write to my Queue with no problem. However, what event[/color]
            is[color=blue]
            > raised when something is added to the queue. Currently, I'm polling the
            > queue to see if it has anything in it and then processing accordingly.[/color]
            But[color=blue]
            > that seems like an awkward way to handle messages b/c I might interrogate
            > the queue x number of times when there's nothing in it. If I could just
            > wake up the client app when anything is added to the queue, it seems like
            > it'd be much better solution.
            >
            > Is there a way to do this, namely, for the queue to send a notification[/color]
            that[color=blue]
            > something has been added or that it has stuff in it?
            >
            > TIA,
            >
            > Bill
            >
            > --
            > Cordially,
            >
            > W.G. Ryan
            > dotnetguru@comc ast.nospam.net
            > www.devbuzz.com
            > www.knowdotnet.com
            >
            >[/color]


            Comment

            • William Ryan

              #7
              Re: MSMQ

              Thank you.
              "Rolf Enidsson" <rolf.enidsson@ re-m-ove.msecf.rem-ove.com> wrote in message
              news:eGj6emvlDH A.1948@TK2MSFTN GP12.phx.gbl...[color=blue]
              > If you use .NET Framework (as I suspect so since you post here) you can[/color]
              use[color=blue]
              > async programming. Look att BeginReceive / EndReceive in the MessageQueue
              > class. Read more at
              >[/color]
              http://msdn.microsoft.com/library/de...asp?frame=true[color=blue]
              >
              > In fact, that whole chapter might be interesting for you.
              >[/color]
              http://msdn.microsoft.com/library/de...asp?frame=true[color=blue]
              >
              > Also there is at least one other article about MSMQ and services at
              >[/color]
              http://msdn.microsoft.com/library/de...asp?frame=true[color=blue]
              >
              >
              > "William Ryan" <dotnetguru@nos pam.comcast.net > wrote in message
              > news:uWtcbumlDH A.1096@TK2MSFTN GP11.phx.gbl...[color=green]
              > > I'm starting to play with MSMQ and have a really newbie question...
              > >
              > > I can effectively write to my Queue with no problem. However, what[/color][/color]
              event[color=blue]
              > is[color=green]
              > > raised when something is added to the queue. Currently, I'm polling the
              > > queue to see if it has anything in it and then processing accordingly.[/color]
              > But[color=green]
              > > that seems like an awkward way to handle messages b/c I might[/color][/color]
              interrogate[color=blue][color=green]
              > > the queue x number of times when there's nothing in it. If I could just
              > > wake up the client app when anything is added to the queue, it seems[/color][/color]
              like[color=blue][color=green]
              > > it'd be much better solution.
              > >
              > > Is there a way to do this, namely, for the queue to send a notification[/color]
              > that[color=green]
              > > something has been added or that it has stuff in it?
              > >
              > > TIA,
              > >
              > > Bill
              > >
              > > --
              > > Cordially,
              > >
              > > W.G. Ryan
              > > dotnetguru@comc ast.nospam.net
              > > www.devbuzz.com
              > > www.knowdotnet.com
              > >
              > >[/color]
              >
              >[/color]


              Comment

              Working...