2012-08-30 2 views
1

ID, 이름, 날짜가있는 MySql db dblookup 중재자를 사용하여이 행을 가져오고 싶지 않거나, 작동하지 않는 것처럼 보입니다. 누군가 내 프록시 정의를 확인해 주시겠습니까?wso2 ESB dblookup 중재자

<proxy xmlns="http://ws.apache.org/ns/synapse" name="Database" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> 
    <target> 
     <inSequence> 
     <dblookup> 
      <connection> 
       <pool> 
        <password>1234</password> 
        <user>root</user> 
        <url>jdbc:mysql://localhost:3306/new_db</url> 
        <driver>com.mysql.jdbc.Driver</driver> 
       </pool> 
      </connection> 
      <statement> 
       <sql>select * from users where name=?</sql> 
       <result name="client_expiration" column="expiration" /> 
       <result name="client_id" column="id" /> 
       <result name="client_name" column="name" /> 
      </statement> 
     </dblookup> 
     <log /> 
     </inSequence> 
    </target> 
</proxy> 

답변

3

여러 데이터를 검색 할 때 문제가 있습니다. 여러 데이터를 검색하려고하면 데이터의 첫 번째 행이 반환됩니다. 반환 된 값은 시냅스 메타 텍스트에 저장됩니다. 로그 중재자를 사용하면 결과를 볼 수 있습니다. 다음과 같이 사용하십시오. 이

<sql>select * from users where name=ABC</sql> 

는 다음과 같이 로그 (하나 개의 데이터 행을 검색하는)처럼

는 SQL 쿼리를 변경

;

<log level="custom"> 
    <property name="returned value for client_expiration is : "  expression="get-property('client_expiration')"/> 
    <property name="returned value for client_id is : "  expression="get-property('client_id')"/> 
    <property name="returned value for client_name is : "  expression="get-property('client_name')"/> 
</log> 
+0

cool! 메시지에 이러한 값을 넣으려면 중재자를 사용하면됩니까? – nuvio

+1

예 : 중재자 중재자를 사용하십시오. 단순 속성 중개자를 사용하십시오. : 그런 다음 enrich 중재자 인 "cliExp"속성을 사용하십시오. – Ratha

+0

Ratha, 당신이 wso2-esb의 진정한 전문가라는 것을 알 수 있습니다. 그래서 나는 당신이 내가 출판 한 다른 질문을 보도록 권하고 싶습니다 : http://stackoverflow.com/questions/12157425/wso2-esb-api -management 많은 도움을 주신 데 대해 다시 한 번 감사드립니다. – nuvio