Apama 10.15.3 | Connecting Apama Applications to External Components | Standard Connectivity Plug-ins | The Digital Event Services Transport Connectivity Plug-in | Using Digital Event Services connectivity from EPL
 
Using Digital Event Services connectivity from EPL
As with all connectivity plug-ins, the EPL application is responsible for telling the system when it is ready to start receiving events with onApplicationInitialized. See also Sending and receiving events with connectivity plug-ins.
Each Digital Event Services event type maps to its own dedicated Apama channel. The channel name is accessed via the static CHANNEL constant on the EPL type. With CHANNEL, you can send, subscribe and unsubscribe in the same way as any other Apama channel.
For example, you have a digital event type called pkg1.pkg2.MyEvent, with fields anInteger and aString on it. If you select this type in Software AG Designer, you are able to write EPL such as the following:
using com.softwareag.connectivity.ConnectivityPlugins;
using pkg1.pkg2.MyEvent;
...
 
ConnectivityPlugins.onApplicationInitialized();
monitor.subscribe(MyEvent.CHANNEL); // This context will now receive digital
// events of type 'pkg1.pkg2.MyEvent'
 
on all MyEvent() as e {
print "Got an event from DES: " + e.toString();
}
 
MyEvent e2 := new MyEvent;
e2.anInteger := 100;
e2.aString := "Hello world!";
send e2 to MyEvent.CHANNEL; // Sends this event out to Digital Event Services
There is one thing about digital events that is totally different from Apama events. Digital events of different types are not guaranteed to be received by Digital Event Services in the same order as they were sent. When you are sending Apama events as shown in the following example, then it is guaranteed that the destination context (ctx) can see the A and B events in the same order as they were sent.
send A(1) to ctx;
send B(1) to ctx;
send A(2) to ctx;
send B(2) to ctx;
If you are sending digital events as shown in the example below, any other product (or even Apama) that is receiving these events from Digital Event Services is guaranteed to see A(2) after A(1), and B(2) after B(1). These A and B events, however, might (or might not) be interleaved differently.
send A(1) to A.CHANNEL;
send B(1) to B.CHANNEL;
send A(2) to A.CHANNEL;
send B(2) to B.CHANNEL;
If you want to deploy or export an Apama application which uses digital events (for example, using an Ant script) to another machine (for example, from development to production), keep in mind that you also have to deploy the digital event type repository from one machine to the other. The same type repository on which you have developed your application needs to be available in all the places in which you run your application. For more information, see Using Digital Event Services to Communicate between Software AG Products.