May I ask if anyone knows if it's possible and how to send alarms to a specified alarm queue if there are more than one alarm queues subscribed to a hub? If you could direct me to the methods in Nimsoft API, that would be great.
Queues are based on the message subject. Therefore any message on the bus with the subject of alarm will end up in any queue that has been defined to contain messages with the subject of alarm. If you want to have alarms posted to a separate queue, realizing that the original message will still be in any queue with the subject of alarm. You don't really need to use the API to perform this type of operation, send an alarm messsage with a different subject. All you need to do is define the queue with the desired subject, then using the nas AO profiles, create a profile with an action type of Repost and use the desired subject for the message. This will place the original alarm back on the message bus with a different subject.
If you don't think this will work for what you want, then perhaps you can provide more detail as to the requirement.
Your instructions have been very helpful. I'd still like to learn how to do this via Nimbus API.The reason I asked was that all alarms generated would go to a temporary queue for attaching origins before forwarding to NAS queue. Profiles & pre-processing rules would have not been applied yet. I'd like to be able to bypass the temporary queue and send alarms directly to the NAS queue.
I found the example below in documentation. "TestMessage" is the subject of the post. If I change that to "NASqueue", for example, the alarm will be posted directly to the NAS queue. Is that correct?
// Create message
Post post = new Post("TestMessage");
post.Data.PutString("message", "This is a test");
// Create session
NimbusSession session = new NimbusSession();
// Send message
PDS ret = session.SendMessage(post);
You can make the subject any thing you like. The queue(s) into which a message goes is cointrolled by the configuration of the hub. You can tell the hub to put any subject(s) you like into the nas queue. I believe that you need to configure the NAS to accept messages with ohter subjects if you are using something other than "alarm".
Thanks kruepke! I think I has learned more on how this works.
BTW, I tried the example from Nimbus API documentation, and I got "object reference not set to an instance of an object". When I changed from using Post class to Alarm class, it worked fine. However, I can't use Alarm as it doesn't let me change the subject. Was I missing something? (I'm using C#)
Also, what's the difference between SendMessage and PostMessage?
============= This doesn't work - returns "object reference not set..." ==================
NimbusSession alarmSession = new NimbusSession();
PDS message = new PDS();
message.PutString("message", "THIS IS A TEST. PLEASE IGNORE");
Post post = new Post("alarm", message);
PDS ret = alarmSession.SendMessage(new Post("alarm", message));
============= This works fine, alarm gets generated =============
Alarm alarm = new Alarm("THIS IS A TEST. PLEASE IGNORE",SeverityLevel.Information);
PDS ret = alarmSesstion.SendMessage(alarm);
Retrieving data ...