how integrate pollable channel in integration flow. flow using nullchannel instead of pollable channel. can 1 kindly provide pointer on this.
this integration flow. @bean public integrationflow sftpinboundflow() { system.out.println("enter sftpinboundflow....." + sftpsessionfactory.getsession()); system.out.println("the channel " + sftpinboundresultchannel); return integrationflows .from(sftp.inboundadapter(this.sftpsessionfactory) .preservetimestamp(true).remotedirectory(remdir) .regexfilter(".*\\.txt$") .localfilenameexpression("#this.touppercase()") .localdirectory(new file(localdir)) .remotefileseparator("/"), new consumer<sourcepollingchanneladapterspec>() { @override public void accept(sourcepollingchanneladapterspec e) { e.id("sftpinboundadapter") .autostartup(true) .poller(pollers.fixedrate(1000) .maxmessagesperpoll(1)); } }) .channel(messagechannels.queue("sftpinboundresultchannel")) .get(); } , want use this.. @autowired private pollablechannel sftpinboundresultchannel; in .channel() method. and logs are... [2015-07-22 18:48:05.497] - 2796 info [main] --- com.jcraft.jsch: ssh_msg_newkeys sent [2015-07-22 18:48:05.497] - 2796 info [main] --- com.jcraft.jsch: ssh_msg_newkeys received [2015-07-22 18:48:05.500] - 2796 info [main] --- com.jcraft.jsch: ssh_msg_service_request sent [2015-07-22 18:48:05.501] - 2796 info [main] --- com.jcraft.jsch: ssh_msg_service_accept received [2015-07-22 18:48:15.517] - 2796 info [main] --- com.jcraft.jsch: authentications can continue: gssapi-with-mic,publickey,keyboard-interactive,password [2015-07-22 18:48:15.517] - 2796 info [main] --- com.jcraft.jsch: next authentication method: gssapi-with-mic [2015-07-22 18:48:15.522] - 2796 info [main] --- com.jcraft.jsch: authentications can continue: publickey,keyboard-interactive,password [2015-07-22 18:48:15.522] - 2796 info [main] --- com.jcraft.jsch: next authentication method: publickey [2015-07-22 18:48:15.523] - 2796 info [main] --- com.jcraft.jsch: authentications can continue: password [2015-07-22 18:48:15.523] - 2796 info [main] --- com.jcraft.jsch: next authentication method: password [2015-07-22 18:48:15.537] - 2796 info [main] --- com.jcraft.jsch: authentication succeeded (password). enter sftpsessionfactory.....org.springframework.integration.sftp.session.sftpsession@1ffcd26 enter sftpinboundflow.....org.springframework.integration.sftp.session.sftpsession@13a462c channel org.springframework.integration.channel.nullchannel@d532ee [2015-07-22 18:48:15.827] - 2796 info [main] --- org.springframework.context.support.defaultlifecycleprocessor: starting beans in phase -2147483648 [2015-07-22 18:48:15.828] - 2796 info [main] --- org.springframework.context.support.defaultlifecycleprocessor: starting beans in phase 0 [2015-07-22 18:48:15.828] - 2796 info [main] --- org.springframework.integration.endpoint.eventdrivenconsumer: adding {logging-channel-adapter:_org.springframework.integration.errorlogger} subscriber 'errorchannel' channel [2015-07-22 18:48:15.828] - 2796 info [main] --- org.springframework.integration.channel.publishsubscribechannel: channel 'application.errorchannel' has 1 subscriber(s). [2015-07-22 18:48:15.829] - 2796 info [main] --- org.springframework.integration.endpoint.eventdrivenconsumer: started _org.springframework.integration.errorlogger [2015-07-22 18:48:15.829] - 2796 info [main] --- org.springframework.context.support.defaultlifecycleprocessor: starting beans in phase 1073741823 [2015-07-22 18:48:15.832] - 2796 info [main] --- org.springframework.integration.endpoint.sourcepollingchanneladapter: started sftpinboundadapter [2015-07-22 18:48:15.834] - 2796 info [main] --- src.mainsftpinbounddsl: started mainsftpinbounddsl in 11.019 seconds (jvm running 11.182) enter main..... enter main..... [2015-07-22 18:48:16.040] - 2796 info [task-scheduler-1] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\amarjeet.txt, headers={timestamp=1437571096040, id=ddc20f6d-26ee-7eef-f59e-b5207dcdc8c7}]] [2015-07-22 18:48:16.832] - 2796 info [task-scheduler-1] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\info.txt, headers={timestamp=1437571096832, id=361b55d5-884e-9001-d513-ddc81926bf85}]] [2015-07-22 18:48:17.832] - 2796 info [task-scheduler-2] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\kkkk.txt, headers={timestamp=1437571097832, id=49deb17c-50e3-4315-dfa2-cc443a35bd1c}]] [2015-07-22 18:48:18.832] - 2796 info [task-scheduler-1] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\la.txt, headers={timestamp=1437571098832, id=88def298-ab86-1d63-039e-c81c70ae6819}]] [2015-07-22 18:48:19.832] - 2796 info [task-scheduler-3] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\poc.txt, headers={timestamp=1437571099832, id=d78b36eb-10f5-ce83-ba4c-cd24a806480b}]] [2015-07-22 18:48:20.832] - 2796 info [task-scheduler-2] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\pppp.txt, headers={timestamp=1437571100832, id=4e727ebb-b4de-be19-6a92-afb3be24576f}]] [2015-07-22 18:48:21.832] - 2796 info [task-scheduler-4] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\reference.txt, headers={timestamp=1437571101832, id=3d611371-431c-6b1e-0e17-377f5607de96}]] [2015-07-22 18:48:22.831] - 2796 info [task-scheduler-1] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\rrrrr.txt, headers={timestamp=1437571102831, id=707e566c-ccfa-6c32-16d6-1f27ec73abaf}]] [2015-07-22 18:48:23.832] - 2796 info [task-scheduler-5] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\sftp.txt, headers={timestamp=1437571103832, id=b3c979ff-fcd2-e1ff-8b37-6b8f2803637a}]] [2015-07-22 18:48:24.832] - 2796 info [task-scheduler-3] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\test.txt, headers={timestamp=1437571104832, id=98d43e62-8e5f-69bc-7617-4706761eaf86}]] [2015-07-22 18:48:25.832] - 2796 info [task-scheduler-3] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\xss.txt, headers={timestamp=1437571105832, id=77b28259-0287-0ef5-825f-5345d6c21c21}]] [2015-07-22 18:48:26.832] - 2796 info [task-scheduler-3] --- org.springframework.integration.file.filereadingmessagesource: created message: [genericmessage [payload=d:\local_copy\zzzz.txt, headers={timestamp=1437571106832, id=b5644a62-8c8c-86d2-e016-75fff01c70b4}]]
just use autowired field directly in flow...
.channel(this.sftpinboundresultchannel) edit:
it looks messagechannels.queue("sftpinboundresultchannel") not registering channel bean spring autowiring nullchannel field (because it's pollablechannel in context).
we need take @ that; in meantime, add
@bean public pollablechannel sftpinboundresultchannel() { return new queuechannel(); }
Comments
Post a Comment