How to Create a Custom Converter for the Inbound JMS Adapter

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. 7-16 Oracle Complex Event Processing Developers Guide directory that contains the JMS adapter configuration file; because this procedure directs you to actually change to the directory, the example shows .. The config_file parameter refers to the name of your JMS adapter configuration file. Finally, the msainternal.dat_file parameter refers to the location of the .msainternal.dat file associated with your domain; by default this file is located in the DOMAIN_DIRservername directory, where DOMAIN_DIR refers to the domain directory such as oracle_cepuser_ projectsdomainsmydomain and servername refers to the server instance. The encryptMSAConfig command comes in two flavors: encryptMSAConfig.cmd Windows and encryptMSAConfig.sh UNIX. After you run the command, the value of the password element will be encrypted, as shown in bold in the following example: jms-adapter namejmsInboundname jndi-provider-urlt3:localhost:7001jndi-provider-url destination-jndi-nameQueue1destination-jndi-name userweblogicuser password{Salted-3DES}B7L6nehu7dgPtJJTnTJWRA==password work-managerJettyWorkManagerwork-manager concurrent-consumers1concurrent-consumers session-transactedfalsesession-transacted jms-adapter 4. Using your favorite XML editor, edit the JMS adapter configuration file. Change the password element whose value is now encrypted to encrypted-password, as shown in bold in the following example: jms-adapter namejmsInboundname jndi-provider-urlt3:localhost:7001jndi-provider-url destination-jndi-nameQueue1destination-jndi-name userweblogicuser encrypted-password{Salted-3DES}B7L6nehu7dgPtJJTnTJWRA==encrypted-password work-managerJettyWorkManagerwork-manager concurrent-consumers1concurrent-consumers session-transactedfalsesession-transacted jms-adapter

7.5 Configuring the JMS Adapter EPN Assembly File

For each JMS adapter in your event processing network, you must add a corresponding wlevs:adapter element to the EPN assembly file of your application; use the provider attribute to specify whether the JMS adapter is inbound or outbound. As with any other stage in the EPN, add listeners to the wlevs:adapter element to integrate the JMS adapter into the event processing network. Typically, an inbound JMS adapter is the first stage in an EPN because it receives messages and an outbound JMS adapter would be in a later stage because it sends messages. However, the requirements of your own Oracle CEP application define where in the network the JMS adapters fit in. For both JMS inbound and outbound adapters, if you have created a custom converter bean to customize the conversion between the JMS messages and event types, first use the standard bean Spring element to declare it in the EPN assembly file. Then pass a reference of the bean to the JMS adapter by specifying its id using the 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