java - Find an appropriate queue-consumer pair -
i need implement of spring-intagration libraries message pipeline. @ beginning, see now, needs contain several elements:
a. messaging gateway,
@messaginggateway(name = "entrygateway", defaultrequestchannel = "requestchannel") public interface messagegateway { public boolean processmessage(message<?> message); }
which called when want start pipeline:
messagegateway.processmessage(message);
b. channel transmitting messages:
@bean public messagechannel requestchannel() { return new directchannel(); }
c.router decides flow messages
@messageendpoint @component public class messagetyperouter { logger log = logger.getlogger(messagetyperouter.class); @router(inputchannel="requestchannel") public string processmessagebypayload(message<?> message){...}
there can many incoming messages in small period of time, wanted realize channel (b) queuechannel:
@bean public messagechannel requestchannel() { return new queuechannel(); }
on other hand router start message comes through gateway , other messages wait in queue. in case received error, said should have used poller.
may give me piece of advice, how can realize scheme. thank in advance.
as know xml config must declare <poller>
component , mark default="true"
. allows pollingconsumer
endpoint pick default
poller context.
with java config must declare @bean
similar purpose:
@bean(name = pollermetadata.default_poller) public pollermetadata defaultpoller() { pollermetadata pollermetadata = new pollermetadata(); pollermetadata.settrigger(new periodictrigger(10)); return pollermetadata; }
where pollermetadata.default_poller
specific constant define default
poller. although same name used xml config in case of default="true"
.
from other side @router
annotation has poller
attribute specify similar nested <poller>
in xml.
Comments
Post a Comment