Hello,
There are two services:
Service 1 - Publishes “PlatformCreatedEvent” to a RMQ exchange.
Service 2 - Consumes this message to trigger a saga.
Here is the problem. The saga is not triggered since axon is not aware of this received event in Service 2. I don’t know how to configure Axon with Spring Cloud Stream with RMQ.
Since I see message being received in Service 2 in the handlePlatformCreated function, I am leaving out the configuration of Service 1.
SERVICE 2 Snippets:
class OnboardingSaga {
private val businessId = ""
@Autowired
@Transient
lateinit var commandGateway: CommandGateway
@StartSaga
@SagaEventHandler(associationProperty = "id", keyName = "businessId")
fun handle(event: PlatformCreatedEvent) {
println("I am not being triggered!")
}
}
@Configuration
class AxonConfig {
@Bean
fun sagaConfiguration(): SagaConfiguration<*> {
return SagaConfiguration.trackingSagaManager(OnboardingSaga::class.java)
}
}
@Component
interface Service2Channels {
@Input(ApplicationExchanges.PLATFORM_CREATED)
fun platformCreated(): SubscribableChannel
}
@EnableBinding(Service2Channels::class)
class PlatformEventConsumer {
@StreamListener(ApplicationExchanges.PLATFORM_CREATED)
fun handlePlatformCreated(event: PlatformCreatedEvent) {
println(">>>>> I am being triggered! YAY!!!)
}
}
Thanks