How to Configure a JMS Adapter for Tibco EMS JMS Manually

Configuring JMS Adapters 7-13 The message parameter corresponds to the incoming JMS message and the return value is a List of events that will be passed on to the next stage of the event processing network. See the Oracle Fusion Middleware Java API Reference for Oracle Complex Event Processing for a full description of these APIs. To create a custom converter for the inbound JMS adapter: 1. Using the Oracle CEP IDE for Eclipse or your preferred IDE, add a Java class to your application project. 2. Implement the com.bea.wlevs.adapters.jms.api.InboundMessageConverter interface. Example 7–10 shows a possible implementation. Example 7–10 Custom Converter for an Inbound JMS Adapter package com.customer; import com.bea.wlevs.adapters.jms.api.InboundMessageConverter; import com.bea.wlevs.adapters.jms.api.MessageConverterException; import com.bea.wlevs.adapters.jms.api.OutboundMessageConverter; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; import javax.jms.TextMessage; import java.util.ArrayList; import java.util.List; public class MessageConverter implements InboundMessageConverter, OutboundMessageConverter { public List convertMessage message throws MessageConverterException, JMSException { TestEvent event = new TestEvent; TextMessage textMessage = TextMessage message; event.setString_1textMessage.getText; List events = new ArrayList1; events.addevent; return events; } public ListMessage convertSession session, Object inputEvent throws MessageConverterException, JMSException { TestEvent event = TestEvent inputEvent; TextMessage message = session.createTextMessage Text message: + event.getString_1 ; ListMessage messages = new ArrayListMessage; messages.addmessage; return messages; } } 3. Specify the converter in your application EPN assembly file as Example 7–11 shows: ■ Register the convert class using a bean element. ■ Associate the converter class with the JMS adapter by adding a wlevs:instance-property with name set to converterBean and ref set to the id of bean. Example 7–11 Specifying a Converter Class for an Inbound JMS Adapter in the EPN Assembly File ... 7-14 Oracle Complex Event Processing Developers Guide 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 ... 4. Package the Java class with your application. For more information, see Chapter 24, Assembling and Deploying Oracle CEP Applications .

7.3.2 How to Create a Custom Converter for the Outbound JMS Adapter

The custom converter bean for an outbound JMS must implement the com.bea.wlevs.adapters.jms.api.OutboundMessageConverter interface. This interface has a single method: public ListMessage convertSession session, Object event throws MessageConverterException, JMSException; The parameters correspond to an event received by the outbound JMS adapter from the source node in the EPN and the return value is a List of JMS messages. See the Oracle Fusion Middleware Java API Reference for Oracle Complex Event Processing for a full description of these APIs. To create a custom converter for the outbound JMS adapter: 1. Using the Oracle CEP IDE for Eclipse or your preferred IDE, add a Java class to your application project. 2. Implement the com.bea.wlevs.adapters.jms.api.OutboundMessageConverter interface. Example 7–10 shows a possible implementation. Example 7–12 Custom Converter for an Outbound JMS Adapter package com.customer; import com.bea.wlevs.adapters.jms.api.InboundMessageConverter; import com.bea.wlevs.adapters.jms.api.MessageConverterException; import com.bea.wlevs.adapters.jms.api.OutboundMessageConverter; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; import javax.jms.TextMessage; import java.util.ArrayList; import java.util.List; public class MessageConverter implements InboundMessageConverter, OutboundMessageConverter { public List convertMessage message throws MessageConverterException, JMSException { TestEvent event = new TestEvent; TextMessage textMessage = TextMessage message; event.setString_1textMessage.getText; List events = new ArrayList1; events.addevent; return events; } public ListMessage convertSession session, Object inputEvent throws MessageConverterException, JMSException { TestEvent event = TestEvent inputEvent; TextMessage message = session.createTextMessage Text message: + event.getString_1 Configuring JMS Adapters 7-15 ; ListMessage messages = new ArrayListMessage; messages.addmessage; return messages; } } 3. Specify the converter in your application EPN assembly file as Example 7–11 shows: ■ Register the convert class using a bean element. ■ Associate the converter class with the JMS adapter by adding a wlevs:instance-property with name set to converterBean and ref set to the id of bean. Example 7–13 Specifying a Converter Class for an Outbound JMS Adapter in the EPN Assembly File ... bean id=myConverter class=com.customer.MessageConverter wlevs:adapter id=jmsOutbound provider=jms-outbound wlevs:instance-property name=converterBean ref=myConverter wlevs:adapter ... 4. Package the Java class with your application. For more information, see Chapter 24, Assembling and Deploying Oracle CEP Applications .

7.4 Encrypting Passwords in the JMS Adapter Component Configuration File

You can encrypt the password in the JMS adapter configuration file.

7.4.1 How to Encrypt Passwords in the JMS Adapter Component Configuration File

You can encrypt the password in the JMS adapter configuration file. To encrypt passwords in the JMS adapter component configuration file: 1. Open a command window and set your environment as described in Setting Your Development Environment in the Oracle Complex Event Processing Getting Started.

2. Change to the directory that contains the configuration file for your JMS adapter.

3. Execute the following encryptMSAConfig command to encrypt the value of the

password element in the configuration file: prompt ORACLE_CEP_HOMEocep_11.1binencryptMSAConfig . config_file msainternal.dat_file where ORACLE_CEP_HOME refers to the main BEA directory into which you installed Oracle CEP, such as d:\oracle_cep. The second argument refers to the Note: The procedure assumes that you are currently using the password element in the configuration file, along with a cleartext password value, but want to start using the encrypted-password element to encrypt the password.