Excerpt |
---|
|
Description of how to create and use subscriptions with Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | true | ApplicationName |
---|
| Eventing. |
Overview
The Eventing capability of
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | true | ApplicationName |
---|
|
Insert excerpt |
---|
| Eventing |
---|
| Eventing |
---|
nopanel | trueEventing |
---|
|
.
To better understand why this would be useful, suppose that there has been increased pirating activity off the coast of Somalia. Because of these events, a group of intelligence analysts is interested in determining the reason for the heightened hostility and discovering its cause. To do this, analysts need to monitor interesting events occurring in that area. Without
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
Eventing, the analysts would need to repeatedly query for any records of events or intelligence gathered in that area. Analysts would have to keep an eye out for changes or anything of interest. However, with
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
Eventing, the analysts can create a subscription indicating criteria for the types of intelligence of interest. In this scenario, analysts could specify interest in metacards added, updated, or deleted that describe data obtained around the coast of Somalia. Through this subscription,
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | true | ApplicationName |
---|
|
will send event notifications back to the team of analysts containing metadata of interest. Furthermore, they could filter the records not only spatially, but by any other criteria that would zero in on the most interesting records. For example, a fishing company that has operated ships peacefully in the same region for a long time may not be interesting. To exclude metadata about that company, analysts may add contextual criteria indicating to only return records containing the keyword "pirate." How these event notifications are handled and processed is up to the client's event consumer which receives all callbacks from
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | true | ApplicationName |
---|
|
. With the subscription in place, the analysts will be notified only of metadata related to the pirating activity, so analysts can obtain better situational awareness.
The key components of
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
Eventing include:
- Subscription -
Insert excerpt |
---|
| Subscription |
---|
| Subscription |
---|
nopanel | trueSubscription |
---|
|
. - Delivery Method -
Insert excerpt |
---|
| Delivery Method |
---|
| Delivery Method |
---|
nopanel | trueDelivery Method |
---|
|
. - Event Processor -
Insert excerpt |
---|
| Event Processor |
---|
| Event Processor |
---|
nopanel | true | Event Processor |
---|
|
. - Event Consumer - service that receives and processes event notifications on the client side.
- Callback URL - location of Event Consumer.
...
This section discusses how a developer can create subscriptions and event consumers to work with
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
Eventing. More information about
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
Eventing in general can be found in the
Eventing section of the Integrator's Guide.
...
To create a subscription in
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
the developer needs to implement the
ddf.catalog.event.Subscription
interface. This interface extends
org.opengis.filter.Filter
in order to represent the subscription's filter criteria. Furthermore, the
Subscription
interface contains a
DeliveryMethod
implementation.
When implementing Subscription
, the developer will need to override the methods accept
and evaluate
from the Filter
. The accept
method allows the visitor pattern to be applied to the Subscription
. A FilterVisitor
can be passed into this method in order to process the Subscription's
Filter
. In
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | true | ApplicationName |
---|
|
this method is used to convert the
Subscription's
Filter
into a predicate format that is understood by the Event Processor. The second method inherited from
Filter
is
evaluate
. This method is used to evaluate an object against the
Filter's
criteria in order to determine if it matches the criteria. See the
Creating Filters section of the Developer's Guide for more information on OGC Filters.
...
The Event Processor obtains the subscription's DeliveryMethod
and invokes one of its four methods when an event occurs. The DeliveryMethod
then handles that invocation and communicates an event to a specified consumer service outside of
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | true | ApplicationName |
---|
|
. The
DeliveryMethod
implementation typically contains a callback URL. It uses this URL to know where the event consumer is located.
...
An event consumer is a service designed to receive and process event notifications. This event consumer can be any type of service running at a location accessible to
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
. If the service is a SOAP service, the
DeliveryMethod
will need to communicate with it according to its WSDL. On the other hand, if it is a REST service, the
DeliveryMethod
will invoke HTTP operations on the callback URL. Typically, whatever type of service the event consumer is, it will have operations corresponding to each of the created, updated, and deleted events. This way, the consumer will know what type of event occurred on
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
.
Deleting a Subscription
To remove a subscription from
Insert excerpt |
---|
| ApplicationName |
---|
| ApplicationName |
---|
nopanel | trueApplicationName |
---|
|
, the subscription ID is required. Once this is provided, the
ServiceRegistration
for the indicated
Subscription
should be obtained from the
Subscriptions
Map
. Then the
Subscription
can be removed by unregistering the service. The following code demonstrates how this is done:
...