简体   繁体   中英

wso2 EI 611 ActiveMQ

Declared Message store in ESB

<?xml version="1.0" encoding="UTF-8"?>
<messageStore class="org.apache.synapse.message.store.impl.jms.JmsStore" name="MySQLStockAdjustment" xmlns="http://ws.apache.org/ns/synapse">
    <parameter name="store.jms.destination">MySQLStockAdjustment</parameter>
    <parameter name="store.failover.message.store.name">MySQLStockAdjustmentFailover</parameter>
    <parameter name="store.jms.connection.factory">myQueueConnectionFactory</parameter>
    <parameter name="store.producer.guaranteed.delivery.enable">true</parameter>
    <parameter name="store.jms.cache.connection">false</parameter>
    <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
    <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
    <parameter name="store.jms.JMSSpecVersion">1.1</parameter>
</messageStore>

and I just want for beginning to store the mesage in it and than use a proxy to read messages form it ..

proxy is simple

<?xml version="1.0" encoding="UTF-8"?>
<proxy name="stockAdjustment" startOnLoad="true" transports="jms" xmlns="http://ws.apache.org/ns/synapse">
    <target>
        <inSequence>
            <!--  get all data -->
            <sequence key="AdjustmentContext"/>
            <filter regex="MySQL" source="$ctx:StockSource">
                <then>
                    <iterate expression="//request">
                        <target>
                            <sequence>
                                <property expression="//qty" name="qty" scope="default" type="STRING"/>
                                <property expression="//code" name="code" scope="default" type="STRING"/>
                                <log level="custom">
                                    <property expression="fn:concat('parmams:Code: ' ,$ctx:code, ' ;Qty: ',$ctx:qty)" name="info"/>
                                </log>
                                <call blocking="true">
                                    <endpoint key="StockAdjustmentEp"/>
                                </call>
                            </sequence>
                        </target>
                    </iterate>
                </then>
                <else/>
            </filter>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
        <faultSequence>

        </faultSequence>
    </target>
    <parameter name="transport.jms.Destination">MySQLStockAdjustment</parameter>
    <parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
</proxy> 

so when I send a data message trough Postman Im getting the following:

WARN {org.apache.axis2.transport.jms.JMSUtils} - Can't determine size of JMS message; unsupported message type : org.apache.activemq.command.ActiveMQObjectMessage {org.apache.axis2.transport.jms.JMSUtils} ERROR {org.apache.axis2.transport.base.BaseUtils} - Unsupported JMS message type org.apache.activemq.command.ActiveMQObjectMessage {org.apache.axis2.transport.base.BaseUtils} ERROR {org.apache.axis2.transport.jms.JMSMessageReceiver} - Unknown error processing message {org.apache.axis2.transport.jms.JMSMessageReceiver}

message is

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
    <soapenv:Body>
        <StockAdjRequest>
            <source>MySQL</source>
            <request><qty>2</qty><code>PR2</code></request>
            <request><qty>2</qty><code>PR2</code></request>
            <request><qty>2</qty><code>PR2</code></request>
            </StockAdjRequest>
            </soapenv:Body>
            </soapenv:Envelope>

I see that message ended in queue but I can't read it trough ActiveMQ web console ...

I documentation I found that maybe a proble that I need to "...If you are using ActiveMQ 5.12.2 and above when working with message stores, you need to set the following system property on server start up for the JMS message store of the ESB Profile to work as expected.

-Dorg.apache.activemq.SERIALIZABLE_PACKAGES="*" ...."

BUt I dont found HOW to do it ... can anyone help me ?

When you store a message in a JMS queue defining a messageStore and using store mediator, you don't just store the "textual" payload from the message, but the entire java MessageContext object is serialized and store as a binary message in the queue.

To read such a message, you need to use a message processor, you can't read it with a simple JMS proxy or even jms inbound endpoint.

And you can't read it with ActiveMQ console because it can't deserialize it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM