As far as I can tell, adding multiple tags to an event through a collection works fine. However, these tags beyond the first one are not shown in the axon server web interface See the example below:
import nl.overheid.ubb.shared.AbstractComponentTest
import org.assertj.core.api.Assertions.assertThat
import org.axonframework.eventsourcing.annotation.EventTag
import org.axonframework.eventsourcing.eventstore.EventStorageEngine
import org.axonframework.eventsourcing.eventstore.SourcingCondition
import org.axonframework.messaging.core.MessageStream
import org.axonframework.messaging.eventhandling.EventMessage
import org.axonframework.messaging.eventstreaming.EventCriteria
import org.axonframework.messaging.eventstreaming.Tag
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
class Testje {
@Autowired
lateinit var eventStorageEngine1: EventStorageEngine
@Test
fun testje() {
publishEvents(
ExampleEvent(
id1 = "a",
setOf("b", "c"),
),
)
println(eventStorageEngine1::class.qualifiedName)
assertThat(getMessageStream().invoke().asMessageSequence().count()).isEqualTo(2) // including terminal message
}
private fun getMessageStream(): () -> MessageStream<EventMessage> = {
eventStorageEngine1.source(
SourcingCondition.conditionFor(
EventCriteria
.havingTags(Tag.of("tag2", "c")),
),
)
}
private fun MessageStream<EventMessage>.asMessageSequence(): Sequence<EventMessage> = sequence {
while (!isCompleted) {
if (!hasNextAvailable()) continue
yield(next().get().message())
}
}
}
data class ExampleEvent(@EventTag("tag1") val id1: String, @EventTag("tag2") val moreIds: Set<String>)
This test passes However, Looking in the ui, I see:
{tag1=a, tag2=b}
I would have expected {tag1=a, tag2=b, tag2=c}.
update: here is a link to the source code which can be run if so desired:
https://gitlab.com/digilab.overheid.nl/research/uit-betrouwbare-bron/beproevingen/woz-axon-kotlin/-/blob/bug-axonserver/app/src/test/kotlin/nl/overheid/ubb/Testje.kt?ref_type=heads
