AnsweredAssumed Answered

Spooler post_raw_bulk, more info ?

Question asked by Thomas GENTILHOMME Champion on Jul 12, 2017
Latest reply on Jul 21, 2017 by Thomas GENTILHOMME

Hi,

 

To generate new alarm in the product i use the post_raw callback of spooler probe. But it's seem we have a way to do the same in bulk with the callback post_raw_bulk ? (That's not very clear).

 

Someone have more information about this callback? (Like  a PDS Table ?)

 

If i can post in bulk that can be cool for one of my script (the post_raw callback block my thread) and let me generate only 340 alarms every second (not enougth for me).

sub GenerateAlarm {
    my ($PDSHash) = @_;
    my $alarmID = nimId();
    my $PDS     = pdsFromHash($PDSHash);
    $PDS->string('subject',$STR_PostSubject);
    $PDS->string('nimid',$alarmID);
    $Logger->log(1,"Post new alarm $alarmID from $HASH_Robot->{robotname} to spooler!");
    my ($RC,$RES) = nimRequest("$HASH_Robot->{robotname}",48001,"post_raw",$PDS->data);
    $Logger->log(1,"Failed to send alarm => ".nimError2Txt($RC)) if $RC != NIME_OK;
}

my $handleAlarm;
my $alarmQueue = Thread::Queue->new();
$handleAlarm = sub {
    $Logger->info("Thread started!");
    while ( defined ( my $PDSHash = $alarmQueue->dequeue() ) ) {
        my $enriched = 0;
        foreach(@EnrichmentRules) {
            ($PDSHash,$enriched) = $_->processAlarm($PDSHash);
            last if $enriched && $BOOL_ExclusiveEnrichment eq "yes";
        }
        nimPostMessage($STR_PostSubject,Perluim::API::pdsFromHash($PDSHash)->{pds}) if $BOOL_GenerateNewAlarm eq "no";
        GenerateAlarm($PDSHash) if $BOOL_GenerateNewAlarm eq "yes";
        lock($AlarmProcessed);
        $AlarmProcessed++;
    }
    $Logger->info("Thread finished!");
};

 

Thanks.

 

Best Regards,

Thomas

Outcomes