@Override public void initialize(Field field, EntityModel childEntity) { this.childEntity = childEntity; this.routingKey = findAnnotationAttributes(field, AggregateMember.class) .map(map -> (String) map.get("routingKey")) .filter(key -> !Objects.equals(key, EMPTY_STRING)) .orElse(childEntity.routingKey()); }
@SuppressWarnings("unchecked") private Property<Object> extractCommandHandlerRoutingKey(EntityModel<Object> childEntityModel, CommandMessageHandlingMember commandHandler, Field field) { String routingKey = getOrDefault(commandHandler.routingKey(), childEntityModel.routingKey()); Property<Object> property = getProperty(commandHandler.payloadType(), routingKey); if (property == null) { throw new AxonConfigurationException(format( "Command of type [%s] doesn't have a property matching the routing key [%s] necessary to route through field [%s]", commandHandler.payloadType(), routingKey, field.toGenericString()) ); } return property; }
@Override public void initialize(Field field, EntityModel childEntity) { this.childEntity = childEntity; this.routingKey = findAnnotationAttributes(field, AggregateMember.class) .map(map -> (String) map.get("routingKey")) .filter(key -> !Objects.equals(key, EMPTY_STRING)) .orElse(childEntity.routingKey()); }
@SuppressWarnings("unchecked") private Property<Object> extractCommandHandlerRoutingKey(EntityModel<Object> childEntityModel, CommandMessageHandlingMember commandHandler, Field field) { String routingKey = getOrDefault(commandHandler.routingKey(), childEntityModel.routingKey()); Property<Object> property = getProperty(commandHandler.payloadType(), routingKey); if (property == null) { throw new AxonConfigurationException(format( "Command of type [%s] doesn't have a property matching the routing key [%s] necessary to route through field [%s]", commandHandler.payloadType(), routingKey, field.toGenericString()) ); } return property; }