2

ID、NAME、DATEのMySqlデータベースがあります。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>
4

1 に答える 1

3

複数のデータを取得するときに問題があります。複数のデータを取得しようとすると、データの最初の行が返されます。戻り値はシナプスMessagecontextに保存されます。したがって、ログメディエーターを使用するだけで、結果を表示できます。このように使用します。

SQLクエリを次のように変更します(1行のデータを取得するため)

<sql>select * from users where name=ABC</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>
于 2012-08-30T18:11:20.207 に答える