Martijn's blog - E-Commerce, EAI, BizTalk and .NET

2004/07/31

BizTalk 2004 - Suspended Queue Listener Windows Service

Quite a mouth full for the title, but as it says, I've implemented a simple Windows Service component which will watch your Suspended Queue for messages, both realtime and batch-wise.

The batch-wise implementation searches the Queue for Suspended messages upon Service startup and calls a routine which you will implement to do whatever you want with the message from the Queue.

The realtime part is realized by subscribing to a WMI Event fired, called "MSBTS_ServiceInstanceSuspendedEvent". I've supplied the sourcecode for you to have a look at, let me know if you find anything you have questions about or don't agree with. Hope you enjoy this one!

UPDATE:

it's ready for download here

34 Comments:

  • sorry, it was indeed, it's ok now

    By Blogger Martijn Hoogendoorn, at 12:29 AM  

  • I have also implemented such a Windows service for my current project, but as an afterthought, we also added a handler for Win32_NTLogEvent for a subset of relevant event-sources. Just to make sure that none of the slippery errors got away.
    --Dev

    By Anonymous Anonymous, at 10:50 PM  

  • I have tried to download, but the link is broken.

    By Anonymous Anonymous, at 1:12 PM  

  • Using WMI, you can easily access (if you have the appropriate network and machine rights) a remote WMI scope:

    instead of new ManagementObjectSearcher(new ManagementScope ("root\\MicrosoftBizTalkServer"), new WqlObjectQuery(svcInstWQL), null);

    use

    new ManagementObjectSearcher(new ManagementScope (@"\\servername\root\MicrosoftBizTalkServer"), new WqlObjectQuery(svcInstWQL), null);

    HTH

    By Blogger Martijn Hoogendoorn, at 11:36 PM  

  • How do I install the service? I have tried running the executable from the command line, which returns an error:

    "Cannot start service from the command line or a debugger. Use installutil.exe first..."

    and I have also tried running installutil.exe against it which returns this error:

    "No public installers with the RunInstallerAttribute.Yes attribute could be found"

    By Blogger McGeeky, at 4:28 PM  

  • Has anyone run across the issue of seeing multiple events fired for each suspended message? I have this service set up to send emails with each distinct suspended message event captured, and I seem to get about 7 emails per single suspended message event.

    I imagine there's some filtering I can do to ensure I only get 1 email per suspended message. Has anyone worked on this?

    Ben
    bengoeltz@hotmail.com

    By Anonymous Anonymous, at 6:16 PM  

  • Actually, that's not quite the case, the suspended queue listener only listens to messages having been resubmitted above the threshold you can set on the different ports you use. HTH!

    By Blogger Martijn Hoogendoorn, at 11:37 PM  

  • Greg,

    You can resubmit those orders from the HAT (Health and Activity Tracker) by hand if you wish...

    By Blogger Martijn Hoogendoorn, at 11:31 PM  

  • Hey Martijn,

    I have been trying to get your windows service going for having like an application specific error log, to basically get an idea of your implementation. I am able to build your app and am using installutil to install the created exe and it says it installed it fine, but am not able to see windows service in the services manager. Am I missing a step or am I doing something wrong ??

    By Anonymous Anonymous, at 4:14 PM  

  • Martijn,

    This is very useful, thank you. I am using it to send e-mail alerts when messages are suspended. In case anyone else is interested in resuming suspended messages programatically, Microsoft have the following code example:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_wmi_reference_core_tiss.asp

    Also, the following code is useful for terminating large numbers of service instances when testing:

    http://dallas.sark.com/SarkBlog/mholdorf/articles/337.aspx

    The second one could also be adapted to resume the instances instead, by just changing the function name invoked.

    By Anonymous Anonymous, at 5:29 PM  

  • I found your site looking for realtor web site design and thought I'd just say Hi. website design bathurst

    By Anonymous Anonymous, at 11:51 PM  

  • I have tried to download this file and the link is broken.

    By Anonymous Anonymous, at 11:21 PM  

  • Just what I need could you please fix the link...

    By Anonymous Anonymous, at 4:35 PM  

  • Can you give some more exp. about how to use it...

    10x,
    amit

    By Anonymous Anonymous, at 10:21 AM  

  • Hi Martijn,

    You said:
    "Using WMI, you can easily access (if you have the appropriate network and machine rights) a remote WMI scope:

    instead of new ManagementObjectSearcher(new ManagementScope ("root\\MicrosoftBizTalkServer"), new WqlObjectQuery(svcInstWQL), null);

    use

    new ManagementObjectSearcher(new ManagementScope (@"\\servername\root\MicrosoftBizTalkServer"), new WqlObjectQuery(svcInstWQL), null);
    "

    I've tried to do so with a similar WMI code. But I keep getting either "access denied" or "exception: BizTalk Server cannot access SQL server. This could be due to
    one of the following reasons:
    1. Access permissions have been denied to the current user. Either log on as a
    user that has been granted permissions to SQL and try again, or grant the curren
    t user permission to access SQL Server.
    2. The SQL Server does not exist or an invalid database name has been specified.
    Check the name entered for the SQL Server and database to make sure they are c
    orrect as provided during SQL Server installation.
    3. The SQL Server exists, but is not currently running. Use the Windows Service
    Control Manager or SQL Enterprise Manager to start SQL Server, and try again.
    4. A SQL database file with the same name as the specified database already exis
    ts in the Microsoft SQL Server data folder.

    Internal error from OLEDB provider: "Login failed for user '(null)'. Reason: Not
    associated with a trusted SQL Server connection.".

    I'm a BizTalk admin as well as an admin of the local machine. However, I'm not an admini on the SQL server machine.

    Any comments/advice?

    Thx in advance.

    By Anonymous Anonymous, at 7:33 AM  

  • Hi!

    First off, the suspended queue listener is no longer needed if you have a BizTalk Server 2006 installation running.

    Other than that, please contact me by e-mail (listed in this posting: http://martijnh.blogspot.com/2004/07/e-mail-address.html), I will try and answer your question there.

    By Blogger Martijn Hoogendoorn, at 8:02 AM  

  • Is there a way to track resume or terminate invoked on a MSBTS_ServiceInstance? There is no MSBTS_ServiceInstanceResumedEvent or MSBTS_ServiceInstanceTerminatedEvent to listen for.

    By Anonymous Anonymous, at 10:49 AM  

  • Hi Martijn,

    I can't download the source code. It's broken.

    BR

    By Anonymous Anonymous, at 12:21 PM  

  • Hi Martijn,

    I am also getting below error....

    BizTalk Server cannot access SQL server. This could be due to one of the following reasons:
    1. Access permissions have been denied to the current user. Either log on as a user that has been granted permissions to SQL and try again,
    2.....
    .....................


    Internal error from OLEDB provider: "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'."


    I am using remote BTS 2004 and SQL2K.
    I tried SQL admin login for MSDTC still getting the same (above) error...

    Let me know I have missed anything.

    Thank You

    By Anonymous Anonymous, at 7:37 PM  

  • Thanks for this good post. But unfortunately i cannot access the link to download the code. Can you please check the link again

    By Anonymous Anonymous, at 7:48 PM  

  • This comment has been removed by the author.

    By Anonymous Anonymous, at 11:56 AM  

  • By Anonymous Anonymous, at 5:23 AM  

  • You know ,I have some kal geons, and my friend also has some kal gold, do you kouw they have the same meaning, Both of them can be called kal online geons,I just want to buy some
    kal online gold, because there are many kalonline Geons.

    By Anonymous Anonymous, at 4:56 AM  

  • Have you heared about a game which you need use kal geons to play, and you can also borrow kal gold from other players? But you can buy kal online geons, or you will lose the choice if you do not have kal online gold. If you get kalonline Geons, you can continue this game.

    By Anonymous Anonymous, at 5:06 AM  

  • Your article is very good.I like it very much.
    Once upon a time, there was a mouse father.He wanted to marry his daughter to the greatest person in the world.But, who was the greatest person in the world?Oh!
    puma ferrari shoes
    cheap nike shoesThe sun! He must be the greatest person in the world.The mouse father went to talk to the sun."Hello! Mr. Sun.
    puma shoes
    ferrari shoes
    I know you are the greatest person in the world.Would you marry my daughter?""What? I'm not the greatest person in the world. The greatest person is the cloud.If he comes out, I’ll be covered."
    nike shox nz
    Ugg Boots
    The mouse father went to talk to the cloud. “Hello! Mr. Cloud. I know you are the greatest person in the world. Would you marry my daughter?”
    nike 360 air max
    nike shox shoes
    “What? I’m not the greatest person in the world. The greatest person is the wind.If he comes out, I’ll be blown away.”
    cheap puma shoes
    puma drift cat
    The mouse father went to talk to the wind. “Hello! Mr. Wind. I know you are the greatest person in the world.Would you marry my daughter?” “What? I’m not the greatest person in the world. The greatest person is the wall. If he comes out, I’ll be stopped.”
    cheap nike shox
    nike air max 360
    The mouse father went to talk to the wall. “Hello! Mr. Wall. I know you are the greatest person in the world. Would you marry my daughter?” “What? I’m not the greatest person in the world. The greatest person is YOU, the mouse.” “The greatest person in the world is … mouse?” “Yes, the greatest person in the world is mouse. See? If mouse comes out, I’ll be bit!”
    nike air max
    pumas shoes
    The mouse father was very happy. He finally knew mouse was the greatest person in the world. He would marry his daughter to the handsome mouse next door.
    spot season
    Running in Autumn
    It is time for sporting
    cheap jordan shoes

    By Anonymous Anonymous, at 9:49 AM  

  • By Blogger aai333, at 5:05 AM  

  • By Blogger Unknown, at 6:14 AM  

  • Twisted Heart

    By Blogger Unknown, at 8:16 AM  

  • Nice idea! I never try to make a flower tissue before, Anyway, thanks for sharing this post. I've got an idea.

    By Anonymous send flowers to germany, at 7:42 AM  

  • When I see your article, I really agree with you about the blog.I think people will know this after read the information. I hope you will share more with us.

    At the same time, you also can go to our website to find someting that maybe you like. We have
    nike chaussures,nike shox chaussures,
    nike tn,nike tn requin
    nike air max chaussures,nike chaussures femmes.
    nike chaussures homme,nike chaussures enfants
    We have so many kinds of nike shoes that we are sure you will find the one that you like. Besides, we have the special
    MBT chaussures.
    If you like climbing then you can choose the vibram chaussures in our store.
    You can find the Y-3 Yohji Yamamotoand
    Nike Air Jordan are designed for you!

    By Anonymous Anonymous, at 8:23 AM  

  • As with women’s leggings, these seem to be designed to be layered with other clothing items, which do offer a little bit of modesty. Well, I’m not sure this is a trend that will take on, but if it does it’s certain to winter a whole new set of over-exposure solutions as we’ve seen with the camel toe! Moncler men Jackets , Leggings have been hot for women over the past few seasons, but I didn’t think they might extend to the other gender, at least not outside of sporting events that require down jackes, did you?
    Stars are always exposed to dress sexy, but in the winter cold, like the design of Moncler women Jackets to help them wear down the United States and also warm. By the star like Moncler Show, which is a very strong brand.Do you even concern about what they are wearing or using? Do you know that which jacket brand stars love most? The answer is Moncler shop online

    By Blogger sara chen, at 1:40 PM  

  • Thanks you. Very good post.Unless they can offer a really compelling reason for users to come back, it will be the next Bebo, MySpace

    By Anonymous Cannon 10755GF, at 11:25 PM  

  • There may be a large amount of value that you have offered in this blog post, and reading the following comments and debate has actually been interesting, thank you. key cutting Edinburgh

    By Anonymous Anonymous, at 1:09 PM  

  • Look like the link to the zip file is broken ...

    By Blogger SteveC, at 10:37 AM  

Post a Comment

<< Home