I am new to SI and after reading some examples, I am trying to write a program of my own that seems simple enough. The program attempts to read an email message via POP3 and put the message body on a RabbitMQ. It seemed to be working (there is a message on the queue) until I configured RabbitMQ Management so that I could view the Messages and much to my disappointment the payload is EMPTY!
The server reported 1 messages remaining.
Exchange si.test.exchange
Routing Key si.test.binding
Redelivered ●
Properties
priority: 0
delivery_mode: 2
headers:
content_type: application/octet-stream
Payload 0 bytes Encoding: string
Please help as I have tried various variations (chains, different channels, etc) of the code with the same results.
Here is my spring config:
Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-2.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/integration/amqp http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd" xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-mail="http://www.springframework.org/schema/integration/mail" xmlns:util="http://www.springframework.org/schema/util" xmlns:rabbit="http://www.springframework.org/schema/rabbit" xmlns:si="http://www.springframework.org/schema/integration" xmlns:file="http://www.springframework.org/schema/integration/file" > <int:channel id="incomingMail" > </int:channel> <int:channel id="outgoingRabbit" > <int:interceptors> <int:wire-tap channel="loggingChannel"/> </int:interceptors> </int:channel> <int:logging-channel-adapter id="loggingChannel" log-full-message="true" level="DEBUG"/> <!-- replace 'userid and 'password' wit the real values --> <int-mail:inbound-channel-adapter id="pop3ShouldDeleteTrue" store-uri="pop3://#########:#########@my.mailhost.com/INBOX" channel="incomingMail" should-delete-messages="true" auto-startup="true" java-mail-properties="javaMailProperties"> <!-- Will poll every 20 seconds --> <int:poller fixed-rate="20000"/> </int-mail:inbound-channel-adapter> <si:chain input-channel="incomingMail" output-channel="outgoingRabbit"> <si:transformer expression="payload.content"/> </si:chain> <int-amqp:outbound-channel-adapter channel="outgoingRabbit" amqp-template="amqpTemplate" exchange-name="si.test.exchange" routing-key="si.test.binding"/> <util:properties id="javaMailProperties"> <prop key="mail.pop3.socketFactory.fallback">false</prop> <prop key="mail.debug">true</prop> <prop key="mail.pop3.port">995</prop> <prop key="mail.pop3.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop> <prop key="mail.pop3.socketFactory.port">995</prop> </util:properties> <!-- Infrastructure --> <rabbit:connection-factory id="connectionFactory" /> <rabbit:template id="amqpTemplate" connection-factory="connectionFactory" /> <rabbit:admin connection-factory="connectionFactory" /> <rabbit:queue name="si.test.queue" /> <rabbit:direct-exchange name="si.test.exchange"> <rabbit:bindings> <rabbit:binding queue="si.test.queue" key="si.test.binding"/> </rabbit:bindings> </rabbit:direct-exchange> </beans>


Reply With Quote
