1

I've got this configuration:

spring:
  cloud.stream.bindings:
    input-product-created:
      content-type: application/json
      destination: output-product-management
    input-product-deleted:
      content-type: application/json
      destination: output-product-management

And the proper methods withing the handler:

@StreamListener(Channels.PRODUCT_CREATED)
public void inputProductCreated(ProductCreatedEvent event) {
    productService.createFrom(event.getProductDto());
}

@StreamListener(Channels.PRODUCT_DELETED)
public void inputProductDeleted(ProductDeletedEvent event) {
    productService.delete(event.getProductId());
}

For some reason only the first method is invoked (I've analyzed the producer and it properly generates create/delete events). I assume the problem is with multiple events in the same destination. How to differantiate them correctly?

MuchaZ
  • 391
  • 4
  • 18
  • You can't do that; you need to use separate topics. I would expect to see a conversion error when the `ProductCreatedEvent` is attempted to deliver to the second method. – Gary Russell Mar 23 '20 at 13:28

0 Answers0