Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Notifications in BAM can be done in two ways:-

  • CEP based Notifications
  • Hive Script based Notifications

...

Code Block
languagesql
titleSample Hive Script based Notification
CREATE EXTERNAL TABLE IF NOT EXISTS BAMNotifications 
    (id STRING, streamId STRING, country STRING,  requestCount STRING) 
    STORED BY 'org.apache.hadoop.hive.cassandra.CassandraStorageHandler'
    WITH SERDEPROPERTIES ( 
    "wso2.carbon.datasource.name" = "WSO2BAM_UTIL_DATASOURCE" ,
    "cassandra.cf.name" = "bam_notification_messages" , 
    "cassandra.columns.mapping" = ":key,streamId,country,requestCount" );    
    
insert into table BAMNotifications select countryCode, "country_notifications:1.0.0", country, requestCount from CountrySummary where requestCount > 600;

The above snippet can be used with the HTTPD log analyzing sample Hive script.

The Hive script based notifications functionality can be switched off in a specific BAM node by setting the Java system property "disable.notification.task" (i.e. sh wso2server.sh -Ddisable.notification.task).

...