Building Your Event-Driven Architecture : Implementing Event-Driven Architecture with Software AG Products : Configuring NERV : Creating Custom NERV Emit Bundles
Creating Custom NERV Emit Bundles
You can create and initialize a custom NERV emit bundle that will override the default emit logic described in Using the Default NERV Emit Logic.
To create a custom NERV emit bundle
1. In Designer, create a plug-in project.
2. Remove all automatically generated files, except for the MANIFEST.MF file.
3. Add a MyBlueprint.xml and a MyNERVEmit.xml file in the OSGI-INF/blueprint directory.
The resulting structure is as follows:
<project_root>\META-INF\MANIFEST.MF
<project_root>\OSGI-INF\blueprint\
   MyBlueprint.xml
<project_root>\OSGI-INF\blueprint\
   MyNERVEmit.xml
Note:  
You can also use the NERV Emit Example wizard in Designer to create the project structure automatically.
4. Edit the MyBlueprint.xml file in the OSGI-INF/blueprint directory to reference the nervDefaultJMS component and the default error handler preconfigured and exposed by NERV.
The result should be as follows:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<reference id="nervDefaultJMS" interface="org.apache.camel.Component"
filter="(componentId=nervDefaultJMS)"/>
<reference id="nervDefaultErrorHandler"
interface="org.apache.camel.builder.ErrorHandlerBuilder"
filter="(errorHandlerId=nervDefaultErrorHandler)"/>
</blueprint>
5. Edit the MyNERVEmit.xml file in the OSGI-INF/blueprint directory containing your custom Camel context and a route for your event type.
By convention, NERV derives the name of the in-memory channel used as a starting point for event routing from the fully qualified event type name by substituting “{” and “}” with “_”. For example, for events of type:
{http://namespaces.softwareag.com/EDA/WebM/Sample
/CableboxMonitoring}CableboxHealth
the endpoint URI of the in-memory channel is:
vm://_http://namespaces.softwareag.com/EDA/WebM/Sample/
CableboxMonitoring_CableboxHealth?size=1000&amp;blockWhenFull=true
The in-memory channel is created as an internal queue with a default size of 1000 maximum number of messages, and the calling thread is set to block and wait if the channel is full.
Below you can find an example containing the default routing configuration:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="emitContext" autoStartup="true"
xmlns="http://camel.apache.org/schema/spring">
<route errorHandlerRef="nervDefaultErrorHandler">
<from uri="vm://_http://namespaces.softwareag.com/EDA/WebM/Sample/
CableboxMonitoring_CableboxHealth?size=1000&amp;blockWhenFull=true" />
<!-- Please edit the following URI in order to change the default
routing logic -->
<to uri="nervDefaultJMS:topic:Event::WebM::Sample::CableboxMonitoring
::CableboxHealth" />
</route>
</camelContext>
</beans>
6. Edit the MANIFEST.MF file in the META-INF directory. You must also add some import-package clauses to get the bundle to work properly in the Common Platform.
Below you can find an example of the edited MANIFEST.MF file:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: emit.NERVEmitExample
Bundle-SymbolicName: emit.NERVEmitExample
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.softwareag.eda.nerv,
com.softwareag.eda.store.api,
org.apache.camel,
org.apache.camel.builder,
org.osgi.framework
7. Build your project using webMethods Asset Build Environment, and deploy it using webMethods Deployer.
For more information, see the PDF publication webMethods Deployer User’s Guide.
Note:  
When you deploy your custom NERV emit bundle, it overrides the default NERV emit logic. For more information about how to switch back to the default emit logic, see Switching Between Default and Custom NERV Logic.
Copyright © 2016 - 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback