Sending Events to External Components (Sending to receivers)
In this lesson, you will update your EPL program to send Alert events and make them available to receivers that are external to the correlator via a named channel.
Edit the AlertManager monitor to send events
The send
command can also send events to external software via a named channel.
To update your program to send Alert events instead of printing them:
-
Open the
AlertManager.mon
file. -
Change the line of code that prints Alert events to instead use the send command to send Alert events to external software via a channel named
"AlertChannel"
:Change:
print a.toString();
To:
send a to "AlertChannel";
InfoThe Alert event is being published on theAlertChannel
channel. For an external application component to receive the Alert event it must register itself as an event receiver and subscribe to the AlertChannel channel.
To see the results of sending an event (which is being output from the correlator), use the Engine Receive tool.
Start Engine Receive
-
Before running your project, you need to start
engine_receive
to listen for events on a specific channel.Open a new terminal and run the following command:
engine_receive -c AlertChannel -p 5000
Leave this terminal in the background.
-
Run the project.
-
With the project running and events sent, you should now see alert messages appear in the terminal containing
engine_receive
:Alert("TEMP_PRESSURE_RISE","S003",150,1500)
You can import the completed solution for this lesson:
In the Apama Samples Git repository, navigate to the tutorials/EPL_Fundamentals_Completed
directory.