Skip Navigation

Sample Process for Publishing Events

You need a working Red App project with an Activator class.

  1. Add the following required dependencies to your plug-in:



    • The bundle with the context request and response implementations from the event publisher

  2. In your Java code, get the authentication token service. See the relevant step in Authenticating and Requesting Authorization to Use Services.

  3. Add the following Java code to publish an event.

Create an Event object.

Event event = new Event();

Set the Event ID.

event.setId(Event id);

Set the Source ID. event.setSource(Red App ID);

Set the authentication token. event.setAuthKey(Activator.getDefault().getToken());

Create a ServiceContext object.

ServiceContext context = new ServiceContext();

Create a request object or a response object that is specific to the event. Set your request, your response, or both to the context. A response is optional.


Call the process() method of SRWRuntime. Activator.getDefault().getServiceReference(ISRWRuntime.class).postEvent(event); Register your Event  ID in redapp.xml. An example is shown below.

<RedApp id="Red App id">
    <Event id="SAMPLE_EVENT_001" />