Skip to content

Instantly share code, notes, and snippets.

@spob
Created December 6, 2010 22:40
Show Gist options
  • Select an option

  • Save spob/731122 to your computer and use it in GitHub Desktop.

Select an option

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
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