Hi, im developing a tutorial about how to write TargetAdapters and SourceAdapters, in a few days i will publish first one (TargetAdapter).
Now I m working on SourceAdapter. The problem is that i cannot communicate input to output, let me explain:
my code is a class that extends from AbstractSourceAdapter and initialize looks like:
And XML configuration looks like:Code:final XMPPConnection connection = new XMPPConnection(this.server); try { connection.connect(); connection.login(this.user, this.password); } catch (final XMPPException e) { throw new MessageHandlingException("Error starting", e); } final PacketFilter packetFilter = new MessageTypeFilter( Message.Type.chat); connection.createPacketCollector(packetFilter); final PacketListener packetListener = new PacketListener() { @Override public void processPacket(Packet arg0) { String msn = ((Message) arg0).getBody(); IMSourceAdapter.this.sendToChannel(msn); } }; connection.addPacketListener(packetListener, packetFilter);
Well if i execute this code, I receive messages to processPacket method but it seems like they aren't sent to file-target endpoint.Code:<channel id="inMessage"></channel> <beans:bean id="sourceIM" class="test.spring.integration.im.IMSourceAdapter"> <beans:property name="user" value="logger"></beans:property> <beans:property name="password" value="logger"></beans:property> <beans:property name="server" value="localhost"></beans:property> <beans:property name="channel" ref="inMessage"></beans:property> <beans:property name="messageMapper"> <beans:bean class="test.spring.integration.im.TextIMMessageMapper"></beans:bean> </beans:property> </beans:bean> <file-target directory="c:\\temp" channel="inMessage"/>
If i change that code for:
Obviously works perfect, so i think my problem is in SourceTarget implementation, and i cannot extends from PollableSource because Instant Messaging is 100% asynchronous, doesn't require poll.Code:<channel id="inMessage"></channel> <file-source directory="c:\\temp\\aa" channel="inMessage" poll-period="10000"/> <file-target directory="c:\\temp" channel="inMessage"/>
Any idea of what is happen? Thank you very much, and of course when i finish this example, i will publish.
Thanks.


Reply With Quote
.