Hi Allard,
I realized I missed adding the AMQP config snippet in Service 2:
@Configuration
class AmqpConfig {
@Bean
fun springAMQPMessageSource(serializer: Serializer): SpringAMQPMessageSource {
return object : SpringAMQPMessageSource(serializer) {
// @RabbitListener(queues = [(ApplicationExchanges.PLATFORM_CREATED)])
@StreamListener(ApplicationExchanges.PLATFORM_CREATED)
override fun onMessage(message: Message, channel: Channel) {
super.onMessage(message, channel)
}
}
}
}
I updated the AxonConfig as you suggested.
@Configuration
class AxonConfig {
@Bean
fun onboardingSagaConfiguration(): SagaConfiguration<*> {
return SagaConfiguration.trackingSagaManager(OnboardingSaga::class.java)
}
}
I see the message is received but I get serialization exception for the received event
data class PlatformCreatedEvent(
var id: PlatformId,
var name: String = "",
var awsAccessKey: String = "",
var awsSecretKey: String = ""
)
data class PlatformId(var id: String = IdentifierFactory.getInstance().generateIdentifier()) {
override fun toString(): String {
return id
}
fun identifier(): String {
return id
}
}
The exception is:
2018-03-05 20:42:31.704 WARN 49059 --- [kGqR36QeUMKjw-1] ingErrorHandler$DefaultExceptionStrategy : Fatal message conversion error; message rejected; it will be dropped or routed to a dead letter exchange, if so configured: (Body:'{"id":{"id":"74b91da7-41e7-4f53-97f7-4ebec8b27e67"},"name":"homer","awsAccessKey":"string","awsSecretKey":"string"}' MessageProperties [headers={contentType=text/plain, originalContentType=application/json;charset=UTF-8}, timestamp=null, messageId=null, userId=null, receivedUserId=null, appId=null, clusterId=null, type=null, correlationId=null, correlationIdString=null, replyTo=null, contentType=text/plain, contentEncoding=null, contentLength=0, deliveryMode=null, receivedDeliveryMode=PERSISTENT, expiration=null, priority=0, redelivered=false, receivedExchange=wd-platform-out-platform-created, receivedRoutingKey=wd-platform-out-platform-created, receivedDelay=null, deliveryTag=1, messageCount=0, consumerTag=amq.ctag-9Y6XUpLYSwN0hd2GjlDexw, consumerQueue=wd-platform-out-platform-created.anonymous.v0UkXL4fRkGqR36QeUMKjw])
Issue seems to be with PlatformId (id property of PlatformCreatedEvent)
Body:'{"id":{"id":"74b91da7-41e7-4f53-97f7-4ebec8b27e67"},"name":"homer","awsAccessKey":"string","awsSecretKey":"string"}'
id is set to "id: { uuid }" instead of "{id: uuid}"
The spring cloud stream content type is set to json on both service 1 and 2.
spring.cloud.stream.default.contentType=application/json
Any ideas why the serialization fails?
Thank you