forked from InEngine-NET/InEngine.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMsmqClient.cs
More file actions
41 lines (38 loc) · 1.03 KB
/
MsmqClient.cs
File metadata and controls
41 lines (38 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using Common.Logging;
using System;
using System.Collections.Generic;
using System.Text;
using MSMessageQueue = System.Messaging.MessageQueue;
namespace IntegrationEngine.Core.MessageQueue
{
public class MsmqClient : IMsmqClient
{
public MSMessageQueue MSMessageQueue { get; set; }
string _queueName { get; set; }
public string QueueName {
get { return _queueName; }
set {
if (!MSMessageQueue.Exists(QueueName))
MSMessageQueue.Create(QueueName);
_queueName = value;
}
}
public ILog Log { get; set; }
public void Publish(byte[] message)
{
MSMessageQueue.Send(message);
}
public bool IsServerAvailable()
{
try
{
return MSMessageQueue.Exists(QueueName);
}
catch (Exception exception)
{
Log.Error(exception);
return false;
}
}
}
}