2016-12-02 15 views
0

defaultMuleMessageデータ型から値を抽出しようとしていますが、Mule 3.7.3で正しい構文を取得できません。誰も助けることができますか?defaultMuleMessageから値を取得

私が取得しようとしています値はミュールデバッガで変数タブで発見された:私はデバッガに「initialMessage」と入力した場合は7で

initialMessage (org.mule.DefaultMuleMessage) 
-> properties (org.mule.MessagePropertiesContext) 
--> inboundMap (org.mule.util.CopyOnWrite.CaseInsensitiveMap) 
---> 7 (java.util.Collections$UnmodifiavleMap$UnmodifiableEntrySet$UnmodifiableEntry) 

は、キー=組織

です私はこれを受け取ります:

org.mule.DefaultMuleMessage 
{ 
    id=6980b240-b882-11e6-85f7-d26120524153 
    payload=java.lang.String 
    correlationId=<not set> 
    correlationGroup=-1 
    correlationSeq=-1 
    encoding=UTF-8 
    exceptionPayload=<not set> 

Message properties: 
    INVOCATION scoped properties: 
    _ApikitResponseTransformer_apikitRouterRequest=yes 
    _ApikitResponseTransformer_bestMatchRepresentation=application/json 
    _ApikitResponseTransformer_contractMimeTypes=[MimeType{type='application/json'}] 
    counter=1 
    deterministicOrchestration=true 
    initialMessage=<<<MuleMessage>>> 
    logLevel=INFO 
    maskingEnabled=true 
    messageFormat=JSON 
    messageLocation=CLIENT_REQUEST 
    mongoOperation=insert-object-from-map 
    mongoQuery={messageLocation=client_request, payload={NullPayload}} 
    mongoSynchronous=false 
    nextOrchestratedFlow=products-getProducts 
    orchestrationFlows=[products-getProducts] 
    prevResponse='' 
    INBOUND scoped properties: 
    accept=*/* 
    accept-encoding=gzip, deflate, peerdist 
    accept-language=en-GB 
    organization=abc 
    connection=Keep-Alive 
    host=localhost:8089 
    http.listener.path=/api/* 
    http.method=GET 
    http.query.params=ParameterMap{[]} 
    http.query.string= 
    http.remote.address=/127.0.0.1 
    http.request.path=/api/products 
    http.request.uri=/api/products 
    http.scheme=http 
    http.uri.params=ParameterMap{[]} 
    http.version=HTTP/1.1 
    referer=http://localhost:8089/api/console/ 
    ua-cpu=AMD64 
    user-agent=Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; managedpc; rv:11.0) like Gecko 
    x-p2p-peerdist=Version=1.0 
    x-requested-with=XMLHttpRequest 
    OUTBOUND scoped properties: 
    Content-Type=text/plain;charset=UTF-8 
    MULE_ENCODING=UTF-8 
    SESSION scoped properties: 
    country=usa 
    resource=products 
} 

私は "組織= abc"の値を取得しようとしています。あなたがインバウンドプロパティを取得したい場合は

おかげ

答えて

1

、次のようになってみてください:

#[message.getInvocationProperty('initialMessage').getInboundProperty('organization')] 

UPDATE:

#[message]のタイプはMessageContextなので、Invocationプロパティを直接取得することはできません(MuleMessageからのみ)。上記の式は機能しません。

アップデート2:

は、返信用次#[flowVars.initialMessage.getInboundProperty('organization')]

0

(例えばorganizationと呼ばれる)MELを使用してラバメッセージから、あなただけに持っている:私は質問やコメントから得ることができるものから

#[message.inboundProperties.'organization'] 
+0

感謝を試してみてください。私が見ているミュールフローは、組織を参照する必要があるポイントでインバウンドプロパティを持たず、initialMessageという変数にそれらを保存したように見えるので、値を取得するためにMEL式を書く方法を見つける必要があります上記の構造では、私は取得し、initialMessage変数を通過しようとしたが、少しの成功と – user3165854

0

を前の答えのために。

MuleMessageからインバウンドプロパティを取得しようとしていますが、それ自体はフローのメッセージのプロパティとして利用できます。

次の解決方法を試してください。

#[message.inboundProperties.'initialMessage'.getInboundProperty('organization')] 

これが役に立ちます。

0

initialMessage変数は、次のことを試して、呼び出しのスコープであるので#[message.inboundProperties.organization]