I’m writing integration tests to verify my projection works as expected. I’ve hit a stumbling block when trying to use the
Some background to the problem:
I’m running my axon application, a postgres DB, and Axon Server as part of the integration test using testcontainers.
I have an aggregate, say it is an ‘Order’ aggregate.
I have two integration tests, they do exactly the same thing, except the first one (1) uses a ‘CreateOrder’ command (on the command gateway) and the second one (2) uses an
OrderCreatedevent (on the event gateway).
Each integration test:
Creates an instance of the command (1)/event (2).
Uses the awaitility library to run code which asserts the entity has been created in the DB.
For (1) - where a command is sent - everything works fine. The command is received, the event is stored in axon server (confirmed by inspecting the GUI), and the projection occurs. All assertions pass and so does the test.
However, for (2) where I publish an event - the event never appears in axon server, and the projection never occurs. No assertions pass and so the test fails.
The main difference I can see in the logs is that for (1) there seems to be some log output of actually connecting to Axon Server:
2020-08-13T13:21:16,228 DEBUG [main] o.a.a.c.c.AxonServerCommandBus: Dispatch command [com.example.CreateOrderCommand] with callback
2020-08-13T13:21:16,569 INFO [main] o.a.a.c.AxonServerConnectionManager: Connecting using unencrypted connection…
2020-08-13T13:21:17,710 INFO [main] o.a.a.c.AxonServerConnectionManager: Requesting connection details from localhost:32798
2020-08-13T13:21:18,632 DEBUG [main] o.a.a.c.AxonServerConnectionManager: Received PlatformInfo suggesting [4abe33a7d1f3] (4abe33a7d1f3:8124), reusing existing connection
2020-08-13T13:21:18,632 INFO [main] o.a.a.c.AxonServerConnectionManager: Reusing existing channel
2020-08-13T13:21:18,633 DEBUG [main] o.a.a.c.AxonServerConnectionManager: Start instruction stream to node [4abe33a7d1f3] for context [default]
2020-08-13T13:21:18,661 INFO [main] o.a.a.c.AxonServerConnectionManager: Re-subscribing commands and queries
2020-08-13T13:21:19,035 DEBUG [grpc-default-executor-0] o.a.a.c.c.AxonServerCommandBus$1: Received command response [message_identifier: “a651e4fa-2f10-4271-8560-97e29f0fd246”
For (2) it does not output anything like that. Am I missing some configuration for the EventGateway so that it is usable in my integration test?