/** * Initializes a new command processor with mappers defined in mapping mappingContext. The dynamic access is needed * to instantiate message mappers for an actor system * * @param mappingContext the mapping Context * @param actorSystem the dynamic access used for message mapper instantiation * @param log the log adapter * @return the processor instance * @throws org.eclipse.ditto.model.connectivity.MessageMapperConfigurationInvalidException if the configuration of * one of the {@code mappingContext} is invalid * @throws org.eclipse.ditto.model.connectivity.MessageMapperConfigurationFailedException if the configuration of * one of the {@code mappingContext} failed for a mapper specific reason */ public static MessageMappingProcessor of(final String connectionId, @Nullable final MappingContext mappingContext, final ActorSystem actorSystem, final DiagnosticLoggingAdapter log) { final MessageMapperRegistry registry = DefaultMessageMapperFactory.of(actorSystem, MessageMappers.class, log) .registryOf(DittoMessageMapper.CONTEXT, mappingContext); final ProtocolConfigReader protocolConfigReader = ProtocolConfigReader.fromRawConfig(actorSystem.settings().config()); final ProtocolAdapter protocolAdapter = protocolConfigReader.loadProtocolAdapterProvider(actorSystem).getProtocolAdapter(null); return new MessageMappingProcessor(connectionId, registry, log, protocolAdapter); }
/** * Initializes a new command processor with mappers defined in mapping mappingContext. The dynamic access is needed * to instantiate message mappers for an actor system * * @param mappingContext the mapping Context * @param actorSystem the dynamic access used for message mapper instantiation * @param log the log adapter * @return the processor instance * @throws org.eclipse.ditto.model.connectivity.MessageMapperConfigurationInvalidException if the configuration of * one of the {@code mappingContext} is invalid * @throws org.eclipse.ditto.model.connectivity.MessageMapperConfigurationFailedException if the configuration of * one of the {@code mappingContext} failed for a mapper specific reason */ public static MessageMappingProcessor of(final String connectionId, @Nullable final MappingContext mappingContext, final ActorSystem actorSystem, final DiagnosticLoggingAdapter log) { final MessageMapperRegistry registry = DefaultMessageMapperFactory.of(actorSystem, MessageMappers.class, log) .registryOf(DittoMessageMapper.CONTEXT, mappingContext); final ProtocolConfigReader protocolConfigReader = ProtocolConfigReader.fromRawConfig(actorSystem.settings().config()); final ProtocolAdapter protocolAdapter = protocolConfigReader.loadProtocolAdapterProvider(actorSystem).getProtocolAdapter(null); return new MessageMappingProcessor(connectionId, registry, log, protocolAdapter); }