Configuring Rules and Rule Functions
Configure rules and rule functions according to your needs and HTTP request processing approach.
In the action rule function-based approach
For example, in response to a POST request you might do the following actions:
- Create a servlet request object for the HTTP request using the catalog functions to extract data from the HTTP request.
- Identify the POST request method from the HTTP request and process the parameters and data extracted
- Create a response message to be used in preprocessor or rule or to be sent directly to the HTTP client.
In the event-based approach
For example, in response to a POST request you might do the following actions:
- Create a concept instance, using XPath functions to extract data from the POST data in the request event payload
- Create a response event and use
Event.replyEvent()
to send back an empty response using the request event’s default destination.
As another example, in response to a
GET
request you might do the following actions:
- Identify a concept instance using a property in the request event (created on arrival of the
GET
request message). - As needed, identify or generate data to return and create a response event to hold that data.
- Return the data using
Event.replyEvent
.