In this sample,
- An external producer generate events for the topic "AllStockQuotes" to MB.
- CEP receives events from MB by subscribing for "AllStockQuotes" topic.
- Then CEP extracts several fields from incoming events and publishes them back to MB under the topic "BasicStockQuotes".
- An external consumer receives events by subscribing to "BasicStockQuotes" topic in MB.
2. Goto <CEP_HOME>/repository/conf and open jndi.properties file, then set the following property,
- connectionfactory.TopicConnectionFactory=amqp://admin:admin@clientid/carbon?brokerlist='tcp://localhost:5672'
(5672 is the listening port of the MB)
- topic.BasicStockQuotes = BasicStockQuotes
3. Bring up WSO2 CEP server with the configurations of sample 0002 by executing following command line,
./wso2cep-samples.sh -sn 0002 -DportOffset=1 -Dqpid.dest_syntax=BURL
4. Create an JMS input event adaptor to receive messages from WSO2 MB with following configurations.
5. Create an JMS Output event adaptor to publish messages to WSO2 MB with following configurations.
7. Add a new event formatter to stream org.wso2.sample.stock.quote.basic:1.0.0 as follows,
8. Goto <CEP_HOME>/samples/consumers/jms/src/main/resources and open jndi.properties file, then set the following properties,
- java.naming.factory.initial = org.wso2.andes.jndi.PropertiesFileInitialContextFactory
- connectionfactory.ConnectionFactory=amqp://admin:admin@clientid/carbon?brokerlist='tcp://localhost:5672'
Now goto <CEP_HOME>/samples/consumers/jms and run 'ant topicConsumer -Dtopic=BasicStockQuotes' command. Now the consumer will subscribe to MB for messages on "BasicStockQuotes" topic.
9. Goto <CEP_HOME>/samples/producers/stock-quote/src/main/resources and open jndi.properties file, then set the properties mentioned in step 7 in this file also. Then execute ant command. Now the producer will start publishing events to MB.
In the consumer terminal you must be able to see the receiving stock quote events.