此组件实施 ScheduledPollConsumer。只有来自提供的 'consumeUsers' 的最后一条消息才会检索并作为 Exchange body 发送。如果您不希望在下一个轮询上没有新消息来检索相同的消息,则您可以按照下方所示添加幂等使用者。ScheduledPollConsumer 中的所有选项也可以用于更多对使用者的控制。
			
@Override
public void configure() throws Exception {
 String hipchatEndpointUri = "hipchat://?authToken=XXXX&consumeUsers=@Joe,@John";
 from(hipchatEndpointUri)
  .idempotentConsumer(
    simple("${in.header.HipchatMessageDate} ${in.header.HipchatFromUser}"),
    MemoryIdempotentRepository.memoryIdempotentRepository(200)
  )
  .to("mock:result");
}
@Override
public void configure() throws Exception {
 String hipchatEndpointUri = "hipchat://?authToken=XXXX&consumeUsers=@Joe,@John";
 from(hipchatEndpointUri)
  .idempotentConsumer(
    simple("${in.header.HipchatMessageDate} ${in.header.HipchatFromUser}"),
    MemoryIdempotentRepository.memoryIdempotentRepository(200)
  )
  .to("mock:result");
}
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow