Handling MQTT messages in WSO2 CEP 3.1.0

本秂侑毒 提交于 2020-01-05 22:53:02

问题


I have a scenario in which I have MQTT publisher.

MQTT Client --> Message Broker --> WSO2 CEP (JMS input adaptor)

What are the ways by which I can get this published MQTT message as input to WSO2 CEP?

I tried using ActiveMQ as a message broker and a CEP JMS input adaptor listening to JMS message but ActiveMQ transforms MQTT message as ByteMessage, I believe CEP does not handles it as of now, as JMS messages published in the same setup is working fine.
I know WSO2 CEP 4.0.0 has a feature of MQTT input adaptor. How can I handle it in CEP 3.1.0?


回答1:


Yes, We haven't handled the ByteMessage scenario for JMS input event adapter in CEP 3.1.0. But, we have fixed this in CEP 4.0.0 (and in CEP features which released with BAM 2.5.0)

I like to provide some options to make it work with CEP 3.1.0 .. As Tharik mentioned MQTT input event adapter feature is available from next CEP version (4.0.0). Below are the possible options.

1) You can either patch the JMS input event adpter and include that as a patch for CEP server. (Fix is available in [1])

2) Use the MQTT input event adapter jars which available in BAM 2.5.0. (Build the source [2] and copy the jar to dropins folder of CEP and follow [3])

3) Write your own custom MQTT input event adapter as given in [4]

[1] https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/event-stream/event-input-adaptor/org.wso2.carbon.event.input.adaptor.jms/1.0.2/src/main/java/org/wso2/carbon/event/input/adaptor/jms/internal/util/JMSMessageListener.java

[2] https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/event-stream/event-input-adaptor/org.wso2.carbon.event.input.adaptor.mqtt/1.0.0

[3] https://docs.wso2.com/display/BAM250/Input+MQTT+Event+Adapter

[4] https://mohanadarshan.wordpress.com/2014/07/14/writing-custom-event-adaptors-in-wso2-cep-3-1-0/

Thanks..




回答2:


As you mentioned WSO2 CEP supports MQTT from version 4.0.0 onwards. You event cannot add WSO2 CEP 4.0.0 MQTT components/features to CEP 3.1.0 since input adapter architecture is different in new version.

I highly recommend to use CEP 4.0.0. If you really want this in CEP 3.1.0 you will have to write a custom event adapters for CEP 3.1.0. You can use refer new version source to get some idea but adapter implementation is different.



来源:https://stackoverflow.com/questions/30796606/handling-mqtt-messages-in-wso2-cep-3-1-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!