Read event from another microservice

Hello, i’m new to Axon Framework. I have some questions please.

let’s say we have 2 ms : ms-A, ms-B

  • ms-A publish event : com.mypackage.msa.CreateCustomerEvent (id, name) for Customer Aggregate
  • ms-B will read CreateCustomerEvent of ms-A

i would like to know if it is possible to read the CreateCustomerEvent of ms-A with another class for example com.mypackage.msb.CreateCustomerEvent (id, name) in ms-B ?

i found a solution with :

public class MyEventTypeUpcaster extends SingleEventUpcaster {

    private static final SimpleSerializedType INPUT_TYPE =
            new SimpleSerializedType("com.mypackage.msa.CreateCustomerEvent", null);

    private static final SimpleSerializedType OUTPUT_TYPE =
            new SimpleSerializedType("com.mypackage.msb.CreateCustomerEvent", null);

    @Override
    protected boolean canUpcast(IntermediateEventRepresentation intermediateRepresentation) {
        return intermediateRepresentation.getType().equals(INPUT_TYPE);
    }

    @Override
    protected IntermediateEventRepresentation doUpcast(
            IntermediateEventRepresentation intermediateRepresentation
    ) {
        return intermediateRepresentation.upcastPayload(
                OUTPUT_TYPE,
                com.fasterxml.jackson.databind.JsonNode.class,
                event -> {
                    return event;
                }
        );
    }
}