Created
December 6, 2010 22:40
-
-
Save spob/731122 to your computer and use it in GitHub Desktop.
Sample Web Service to Publish an XML Message to a Scribe InQueue MSMQ Queue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SampleQueueService | |
| { | |
| public class SampleQueueService : IQueueService | |
| { | |
| private const string ScribeInQueue = @"<your env>\private$\scribein"; | |
| /// <summary> | |
| /// Sends a label and XML formated string to a Queue | |
| /// </summary> | |
| /// <param name="label">Mesage Label</param> | |
| /// <param name="xmlData">Message Body</param> | |
| /// <returns></returns> | |
| public bool SendToQueue(string label, string xmlData) | |
| { | |
| bool success = false; | |
| MessageQueue scribeInQueue = null; | |
| try | |
| { | |
| scribeInQueue = new MessageQueue(ScribeInQueue); | |
| scribeInQueue.Send(xmlData, label); | |
| success = true; | |
| } | |
| catch (Exception) | |
| { | |
| success = false; | |
| } | |
| finally | |
| { | |
| if (scribeInQueue != null) | |
| { | |
| scribeInQueue.Close(); | |
| } | |
| } | |
| return success; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment