2014-10-12 3 views
0

использовал RedisMessageTranfomer, чтобы отправить сообщение, чтобы получить полезную нагрузку теста с заголовком redis_command = GET, чтобы переслать исходящий шлюз и перейти к исключению, указанному ниже.spring integration int-redis: исключение исходящего шлюза

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:p="http://www.springframework.org/schema/p" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd 
     http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd 
     http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http.xsd 
     http://www.springframework.org/schema/integration/redis http://www.springframework.org/schema/integration/redis/spring-integration-redis.xsd 
     http://www.springframework.org/schema/integration/ws http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd 
     http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd" 
    xmlns:int="http://www.springframework.org/schema/integration" 
    xmlns:int-file="http://www.springframework.org/schema/integration/file" 
    xmlns:int-http="http://www.springframework.org/schema/integration/http" 
    xmlns:int-mail="http://www.springframework.org/schema/integration/mail" 
    xmlns:int-redis="http://www.springframework.org/schema/integration/redis" 
    xmlns:int-ws="http://www.springframework.org/schema/integration/ws" 
    xmlns:si-xml="http://www.springframework.org/schema/integration/xml"> 


    <int-http:inbound-gateway id="omega" 
     request-channel="channel3" path="/omega" supported-methods="GET,POST" 
     reply-channel="channel5" /> 


    <int:channel id="channel3"> 
     <int:interceptors> 
      <int:wire-tap channel="channel3LoggingChannel" /> 
     </int:interceptors> 
    </int:channel> 

    <int:logging-channel-adapter id="channel3LoggingChannel" 
     level="INFO" expression="'*** Channel3 Log ' + headers + ' -&gt; ' + payload"> 
    </int:logging-channel-adapter> 

    <int:transformer 
     output-channel="channel4" input-channel="channel3" 
     ref="redisMessageTransformer" 
     method="transform"> 
    </int:transformer> 

    <bean id="redisMessageTransformer" 
    class="org.springframework.integration.samples.http.RedisMessageTransformer"/> 


    <int:channel id="channel4"> 
     <int:interceptors> 
      <int:wire-tap channel="channel4LoggingChannel" /> 
     </int:interceptors> 
    </int:channel> 

    <int:logging-channel-adapter id="channel4LoggingChannel" 
     level="INFO" expression="'*** Channel4 Log ' + headers + ' -&gt; ' + payload"> 
    </int:logging-channel-adapter> 


    <int-redis:outbound-gateway request-channel="channel4" 
     reply-channel="channel5" redis-template="redisTemplate" 
     command-expression="'GET'" /> 


    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate"> 
     <constructor-arg ref="redisConnectionFactory"/> 
    </bean> 

    <bean id="redisConnectionFactory" 
     class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" 
     p:use-pool="true" p:host-name="127.0.0.1" p:port="6379" /> 

    <bean 
    id="stringRedisSerializer" 
    class="org.springframework.data.redis.serializer.StringRedisSerializer"/> 

    <bean id="payloadArgumentsStrategy" 
    class="org.springframework.integration.samples.http.PayloadArgumentsStrategy"/> 


    <int:channel id="channel5"> 
     <int:interceptors> 
      <int:wire-tap channel="channel5LoggingChannel" /> 
     </int:interceptors> 
    </int:channel> 

    <int:logging-channel-adapter id="channel5LoggingChannel" 
     level="INFO" expression="'*** Channel5 Log ' + headers + ' -&gt; ' + payload"> 
    </int:logging-channel-adapter> 


</beans> 

package org.springframework.integration.samples.http; 

import org.springframework.integration.redis.support.RedisHeaders; 
import org.springframework.messaging.Message; 
import org.springframework.messaging.support.MessageBuilder; 


public class RedisMessageTransformer { 

    public Object transform(Object object) 
    { 
     Object m = object; 

     System.out.println("*** object.getClass().getName = " + object.getClass().getName()); 

     m = MessageBuilder.withPayload("test").setHeader(RedisHeaders.COMMAND, "GET").build(); 

     System.out.println("*** m = " + m); 

     return m; 
    } 

} 

Исключение

<pre> Server Error</pre></p><h3>Caused by:</h3><pre>java.lang.NoSuchMethodError: org.springframework.data.redis.connection.RedisConnection.execute(Ljava/lang/String;[[B)Ljava/lang/Object; 

    at org.springframework.integration.redis.outbound.RedisOutboundGateway$1.doInRedis(RedisOutboundGateway.java:125) 

    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:162) 

    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:133) 

    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:121) 

    at org.springframework.integration.redis.outbound.RedisOutboundGateway.handleRequestMessage(RedisOutboundGateway.java:121) 

    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:170) 

Что нужно изменить, чтобы получить Redis-outboundgateway читать (GET) значение из Redis>?

ответ

0

org.springframework.data.redis.connection.RedisConnection.execute (Ljava/языки/String; [[В) Ljava/языки/объекта;

H-m ... Какая версия Spring Data Redis вы используете?

Попробуйте использовать это на который приходит как транзитивное зависимость для spring-integration-redis-4.0

+0

спасибо - это была версия выпуск –

+0

Great! Таким образом, он ранил хорошую форму, чтобы принять ответ. благодаря –

Смежные вопросы