How to Create a Custom Converter for the Outbound JMS Adapter

Configuring JMS Adapters 7-17 wlevs:instance-property element, with the name attribute set to converterBean, as shown: bean id=myConverter class=com.customer.MessageConverter wlevs:adapter id=jmsOutbound provider=jms-outbound wlevs:instance-property name=converterBean ref=myConverter wlevs:adapter In this case, be sure you do not specify an event type in the component configuration file because it is assumed that the custom converter bean takes care of specifying the event type. This section describes: ■ Section 7.5.1, JMS Inbound Adapter EPN Assembly File Configuration ■ Section 7.5.2, JMS Outbound Adapter EPN Assembly File Configuration For more information, see: ■ Section 1.1.5, Component Configuration Files. ■ Section B.2, Component Configuration Schema wlevs_application_config.xsd

7.5.1 JMS Inbound Adapter EPN Assembly File Configuration

If you are specifying an inbound JMS adapter, set the provider attribute to jms-inbound, as shown: wlevs:adapter id=jmsInbound provider=jms-inbound The value of the id attribute, in this case jmsInbound, must match the name specified for this JMS adapter in its configuration file. The configuration file configures the JMS destination from which this inbound JMS adapter gets its messages. Because no converter bean is specified, Oracle CEP automatically converts the inbound message to the event type specified in the component configuration file by mapping property names. The following sample EPN assembly file shows how to configure an inbound JMS adapter. The network is simple: the inbound JMS adapter called jmsInbound receives messages from the JMS destination configured in its component configuration file. The Spring bean myConverter converts the incoming JMS messages into event types, and then these events flow to the mySink event bean. ?xml version=1.0 encoding=UTF-8? beans xmlns=http:www.springframework.orgschemabeans xmlns:xsi=http:www.w3.org2001XMLSchema-instance xmlns:osgi=http:www.springframework.orgschemaosgi xmlns:wlevs=http:www.bea.comnswlevsspring xsi:schemaLocation= http:www.springframework.orgschemabeans http:www.springframework.orgschemabeansspring-beans.xsd http:www.springframework.orgschemaosgi http:www.springframework.orgschemaosgispring-osgi.xsd http:www.bea.comnswlevsspring http:www.bea.comnswlevsspringspring-wlevs-v11_1_1_3.xsd wlevs:event-type-repository wlevs:event-type type-name=JMSEvent wlevs:classcom.customer.JMSEventwlevs:class wlevs:event-type wlevs:event-type-repository 7-18 Oracle Complex Event Processing Developers Guide -- Event bean that is an event sink -- wlevs:event-bean id=mySink class=com.customer.MySink -- Inbound JMS adapter with custom converter class; adapter sends events to mySink event bean-- bean id=myConverter class=com.customer.MessageConverter wlevs:adapter id=jmsInbound provider=jms-inbound wlevs:instance-property name=converterBean ref=myConverter wlevs:listener ref=mySink wlevs:adapter beans

7.5.2 JMS Outbound Adapter EPN Assembly File Configuration

If you are specifying an outbound JMS adapter, set the provider attribute to jms-outbound, as shown: wlevs:adapter id=jmsOutbound provider=jms-outbound The value of the id attribute, in this case jmsOutbound, must match the name specified for this JMS adapter in its configuration file. The configuration file configures the JMS destination to which this outbound JMS adapter sends messages. Because no converter bean is specified, Oracle CEP automatically converts the incoming event types to outgoing JMS messages by mapping the property names. The following sample EPN assembly file shows how to configure an outbound JMS adapter. The network is simple: a custom adapter called getData receives data from some feed, converts it into an event type and passes it to myProcessor, which in turn sends the events to the jmsOutbound JMS adapter via the streamOne channel. Oracle CEP automatically converts these events to JMS messages and sends the messages to the JMS destination configured in the component configuration file associated with the jmsOutbound adapter. ?xml version=1.0 encoding=UTF-8? beans xmlns=http:www.springframework.orgschemabeans xmlns:xsi=http:www.w3.org2001XMLSchema-instance xmlns:osgi=http:www.springframework.orgschemaosgi xmlns:wlevs=http:www.bea.comnswlevsspring xsi:schemaLocation= http:www.springframework.orgschemabeans http:www.springframework.orgschemabeansspring-beans.xsd http:www.springframework.orgschemaosgi http:www.springframework.orgschemaosgispring-osgi.xsd http:www.bea.comnswlevsspring http:www.bea.comnswlevsspringspring-wlevs-v11_1_1_3.xsd wlevs:event-type-repository wlevs:event-type type-name=JMSEvent wlevs:classcom.customer.JMSEventwlevs:class wlevs:event-type wlevs:event-type-repository -- Custom adapter that gets data from somewhere and sends it to myProcessor -- wlevs:adapter id=getData class=com.customer.GetData wlevs:listener ref=myProcessor wlevs:adapter wlevs:processor id=myProcessor wlevs:adapter id=jmsOutbound provider=jms-outbound -- Channel for events flowing from myProcessor to outbound JMS adapter -- wlevs:channel id=streamOne wlevs:listener ref=jmsOutbound wlevs:source ref=myProcessor wlevs:channel beans