本文介绍了ObjectStore连接器检索m子中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个流程(A),以poll为源,具有转换逻辑,并通过覆盖最新值将结果数据存储在Mule Object Store连接器中.每当我尝试检索(使用ObjectStore连接器)另一个流(B)中的值时.注意:不从流A调用流(B).我能够第一次从中获得价值.对于下一次,每当它轮询时,我们都应该获取最新值,并且在流A中获取最新值.每当我们检索(使用ObjectStore连接器)获取最新值时.它仅给出存储对象存储的最后一个值.您能否为此提供解决方案.

I have one flow(A) with poll as source with transformation logic and storing result data in Mule Object Store Connector by overwriting latest value. Whenever I tried to retrieve(Using ObjectStore connector) the value in another flow(B).Note : Flow(B) is not called from flow A.I am able to get the value out of it for the first time. For the next time whenever It polls we should get the latest value and we are getting latest value in Flow A. whenever we are retrieving(Using ObjectStore connector) for latest value. It is giving last value only which stored the object store.Could you please provide the solution for this.

推荐答案

以下是我为对象存储设置的内容.我们正在使用Mule 3.8.2.

Here's is my setup for Objectstore. We are using Mule 3.8.2.

FlowA

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore"
xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/objectstore http://www.mulesoft.org/schema/mule/objectstore/current/mule-objectstore.xsd">
<db:oracle-config name="Oracle_Configuration" host="${db.host}"
        port="${db.port}" instance="${db.instance}" user="${db.user}"
        password="${db.password}" doc:name="Oracle Configuration" />
<objectstore:config name="ObjectStore__Connector"
        doc:name="ObjectStore: Connector" />
<flow name="flowA">
    <poll doc:name="Poll">
        <fixed-frequency-scheduler frequency="20000"
                startDelay="20000" />
        <db:select config-ref="Oracle_Configuration" doc:name="Database">
            <db:parameterized-query><![CDATA[select oprt_id from
    table where column = 'Y']]></db:parameterized-query>
        </db:select>
    </poll>
    <choice doc:name="Choice">
        <when expression="#[payload.size() &gt; 0]">
            <objectstore:store config-ref="ObjectStore__Connector"
                    key="keyName" value-ref="#[payload.toString()]" doc:name="ObjectStore"
                    overwrite="true" />
            <logger message="after storing    #[payload]" level="INFO"
                    doc:name="Logger" />
        </when>
        <otherwise>
            <logger message="No data in table" level="INFO" doc:name="Logger" />
        </otherwise>
    </choice>
</flow>
</mule>

FlowB

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/objectstore http://www.mulesoft.org/schema/mule/objectstore/current/mule-objectstore.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
<http:listener-config name="HTTP_Listener_Configuration"
    host="0.0.0.0" port="40955" doc:name="HTTP Listener Configuration" />
<flow name="flowB">
    <http:listener config-ref="HTTP_Listener_Configuration"
        path="/retrieve" allowedMethods="GET" doc:name="HTTP" />
    <logger message="#['Inside Flow A '+message]" level="INFO"
        doc:name="Logger" />
    <objectstore:retrieve config-ref="ObjectStore__Connector"
        doc:name="ObjectStore" key="keyName" />
    <logger message="#['ObjectStore Value='+payload]" level="INFO"
        doc:name="Logger" />
</flow>
</mule>

该表是使用SQL独立更新的. FlowA数据库轮询将更新后的行存储到对象存储中.而且flowB可以正确显示对象存储中的更新值.

The table is updated using SQL independently. FlowA database polling gets the updated rows into the object store.And flowB correctly shows the updated values in objectstore.

我们可以将域中的对象库配置为在应用程序之间共享.请检查对象库的域示例配置

We can configure the objectstore in domain to be shared across applications. Please check the Domain sample configuration for objectstore

这篇关于ObjectStore连接器检索m子中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:31