本文整理汇总了Java中com.networknt.tram.message.consumer.MessageConsumer类的典型用法代码示例。如果您正苦于以下问题:Java MessageConsumer类的具体用法?Java MessageConsumer怎么用?Java MessageConsumer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageConsumer类属于com.networknt.tram.message.consumer包,在下文中一共展示了MessageConsumer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: consumerCommandDispatcher
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
public CommandDispatcher consumerCommandDispatcher() {
MyTestCommandHandler target = Mockito.spy(new MyTestCommandHandler());
ChannelMapping channelMapping = SingletonServiceFactory.getBean(ChannelMapping.class);
MessageConsumer messageConsumer = SingletonServiceFactory.getBean(MessageConsumer.class);
MessageProducer messageProducer = SingletonServiceFactory.getBean(MessageProducer.class);
return new CommandDispatcher("customerCommandDispatcher",
target.defineCommandHandlers(), channelMapping, messageConsumer, messageProducer);
}
示例2: CommandDispatcher
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
public CommandDispatcher(String commandDispatcherId,
CommandHandlers commandHandlers,
ChannelMapping channelMapping,
MessageConsumer messageConsumer,
MessageProducer messageProducer) {
this.commandDispatcherId = commandDispatcherId;
this.commandHandlers = commandHandlers;
this.channelMapping = channelMapping;
this.messageConsumer = messageConsumer;
this.messageProducer = messageProducer;
initialize();
}
示例3: shouldDispatchCommand
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void shouldDispatchCommand() {
String commandDispatcherId = "fooId";
CommandDispatcherTestTarget target = spy(new CommandDispatcherTestTarget());
ChannelMapping channelMapping = mock(ChannelMapping.class);
MessageConsumer messageConsumer = mock(MessageConsumer.class);
MessageProducer messageProducer = mock(MessageProducer.class);
CommandDispatcher dispatcher = new CommandDispatcher(commandDispatcherId,
defineCommandHandlers(target),
channelMapping,
messageConsumer,
messageProducer);
String customerId = "customer0";
String resource = "/customers/" + customerId;
Command command = new TestCommand();
String replyTo = "replyTo-xxx";
String channel = "myChannel";
Message message = CommandProducerImpl.makeMessage(channel, resource, command, replyTo, singletonMap(Message.ID, "999"));
dispatcher.messageHandler(message);
verify(target).reserveCredit(any(CommandMessage.class), any(PathVariables.class));
verify(messageProducer).send(any(), any());
verifyNoMoreInteractions(messageProducer, target);
}
示例4: getCustomerCommandDispatcher
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
public static CommandDispatcher getCustomerCommandDispatcher() {
CustomerCommandHandler customerCommandHandler = SingletonServiceFactory.getBean(CustomerCommandHandler.class);
ChannelMapping channelMapping = SingletonServiceFactory.getBean(ChannelMapping.class);
MessageProducer messageProducer = SingletonServiceFactory.getBean(MessageProducer.class);
MessageConsumer messageConsumer = SingletonServiceFactory.getBean(MessageConsumer.class);
SagaLockManager sagaLockManager = SingletonServiceFactory.getBean(SagaLockManager.class);
return new SagaCommandDispatcher("customerCommandDispatcher",
customerCommandHandler.commandHandlerDefinitions(),
channelMapping,
messageConsumer,
messageProducer,
sagaLockManager);
}
示例5: getOrderCommandDispatcher
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
public static CommandDispatcher getOrderCommandDispatcher() {
OrderCommandHandler orderCommandHandler = SingletonServiceFactory.getBean(OrderCommandHandler.class);
ChannelMapping channelMapping = SingletonServiceFactory.getBean(ChannelMapping.class);
MessageProducer messageProducer = SingletonServiceFactory.getBean(MessageProducer.class);
MessageConsumer messageConsumer = SingletonServiceFactory.getBean(MessageConsumer.class);
SagaLockManager sagaLockManager = SingletonServiceFactory.getBean(SagaLockManager.class);
return new SagaCommandDispatcher("orderCommandDispatcher",
orderCommandHandler.commandHandlerDefinitions(),
channelMapping,
messageConsumer,
messageProducer,
sagaLockManager);
}
示例6: onStartup
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
@Override
public void onStartup() {
MessageConsumer messageConsumer = (MessageConsumer) SingletonServiceFactory.getBean(MessageConsumer.class);
TodoEventConsumer todoEventConsumer = (TodoEventConsumer) SingletonServiceFactory.getBean(TodoEventConsumer.class);
domainEventDispatcher = new DomainEventDispatcher("todoServiceEvents", todoEventConsumer.domainEventHandlers(), messageConsumer);
domainEventDispatcher.initialize();
}
示例7: myReplyConsumer
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
public MyReplyConsumer myReplyConsumer() {
MessageConsumer messageConsumer = SingletonServiceFactory.getBean(MessageConsumer.class);
return new MyReplyConsumer(messageConsumer, "ReplyTo");
}
示例8: MyReplyConsumer
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
public MyReplyConsumer(MessageConsumer messageConsumer, String replyChannel) {
this.messageConsumer = messageConsumer;
this.replyChannel = replyChannel;
subscribe();
}
示例9: DomainEventDispatcher
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
public DomainEventDispatcher(String eventDispatcherId, DomainEventHandlers domainEventHandlers, MessageConsumer messageConsumer) {
this.eventDispatcherId = eventDispatcherId;
this.domainEventHandlers = domainEventHandlers;
this.messageConsumer = messageConsumer;
}
示例10: SagaCommandDispatcher
import com.networknt.tram.message.consumer.MessageConsumer; //导入依赖的package包/类
public SagaCommandDispatcher(String commandDispatcherId, CommandHandlers target, ChannelMapping channelMapping,
MessageConsumer messageConsumer, MessageProducer messageProducer, SagaLockManager sagaLockManager) {
super(commandDispatcherId, target, channelMapping, messageConsumer, messageProducer);
this.sagaLockManager = sagaLockManager;
}