Building Your Event-Driven Architecture : Implementing Event-Driven Architecture with Software AG Products : Configuring NERV : Creating Custom NERV Consume Bundles
Creating Custom NERV Consume Bundles
To create a custom NERV consume 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 MyNERVConsume.xml file in the OSGI-INF/blueprint directory.
4. Create your application-specific Camel processor implementation. In this example, it is the com.softwareag.eda.consumer.ConsoleConsumer class.
The resulting structure is as follows:
C:\<project_name>\cableboxhealth_transformer_bean\src\com\softwareag\eda\
    consumer\ConsoleConsumer.java
C:\<project_name>\cableboxhealth_transformer_bean\
    META-INF\MANIFEST.MF
C:\<project_name>\cableboxhealth_transformer_bean\
    OSGI-INF\blueprint\MyBlueprint.xml
C:\<project_name>\cableboxhealth_transformer_bean\
OSGI-INF\blueprint\
    MyNERVConsume.xml
5. Create an implementation of the org.apache.camel.Processor interface, which consumes the received events.
In the example below, the implementation prints out the content of the event body into the System Output stream.
package com.softwareag.eda.consume;
import org.apache.camel.*;
public class ConsoleConsumer implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
Message message = exchange.getIn();
String body = message.getBody(String.class);
System.out.println(body);
}
}
6. Edit the MyBlueprint.xml file in the OSGI-INF/blueprint directory and reference the nervDefaultJMS component.
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)"/>
</blueprint>
7. Edit the MyNERVConsume.xml file in the OSGI-INF/blueprint directory and reference the nervDefaultJMS component. You must declare your processor class as a bean and include it in a Camel route.
The result should be as follows:
<?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="consumeContext" autoStartup="true"
xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="nervDefaultJMS:topic:Event::WebM::
Sample::CableboxMonitoring::CableboxHealth" />
<to uri="consoleConsumer" />
</route>
</camelContext>
<bean id="consoleConsumer"
class="com.softwareag.eda.consumer.ConsoleConsumer" />
</beans>
8. 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: consume.cableboxhealth
Bundle-SymbolicName: consume.cableboxhealth
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.osgi.framework
9. 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.
Copyright © 2016 - 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback