-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolaceService.cs
43 lines (38 loc) · 1.51 KB
/
SolaceService.cs
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
42
43
/*
I'm not adding the full code here, the general part about context initialization is well documented in the Solace GitHub repos
https://github.com/SolaceSamples/solace-samples-dotnet/tree/master
*/
public List<string> BrowseQueue(string queuename)
{
try
{
List<string> RESULT = new List<string>();
ContextFactoryProperties cfp = new ContextFactoryProperties()
{
SolClientLogLevel = SolLogLevel.Warning
};
cfp.LogToConsoleError();
_instance = ContextFactory.Instance;
_instance.Init(cfp);
using (IContext context = _instance.CreateContext(new ContextProperties(), null))
{
QueueBrowser browser = new QueueBrowser()
{
VPNName = _parameters._VPN_NAME,
UserName = _parameters._USERNAME,
Password = _parameters._PASSWORD
};
RESULT = browser.Run(queuename,context, _parameters._HOST);
}
_instance.Cleanup();
return RESULT;
}
catch (Exception ex)
{
_instance.Cleanup();
Console.WriteLine("Exception thrown: {0}", ex.Message);
throw new SolaceConnectionException();
}
Console.WriteLine("Finished.");
}
}