akka.actor.ExtendedActorSystem Java Examples
The following examples show how to use
akka.actor.ExtendedActorSystem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PersistenceActorTestBaseWithSnapshotting.java From ditto with Eclipse Public License 2.0 | 6 votes |
@Override protected void setup(final Config customConfig) { super.setup(customConfig); eventAdapter = new ThingMongoEventAdapter((ExtendedActorSystem) actorSystem); journalTestHelper = new ThingsJournalTestHelper<>(actorSystem, this::convertJournalEntryToEvent, PersistenceActorTestBaseWithSnapshotting::convertDomainIdToPersistenceId); snapshotTestHelper = new ThingsSnapshotTestHelper<>(actorSystem, PersistenceActorTestBaseWithSnapshotting::convertSnapshotDataToThing, PersistenceActorTestBaseWithSnapshotting::convertDomainIdToPersistenceId); commandToEventMapperRegistry = new HashMap<>(); commandToEventMapperRegistry.put(CreateThing.class, (command, revision) -> { final CreateThing createCommand = (CreateThing) command; return ThingCreated.of(createCommand.getThing(), revision, DittoHeaders.empty()); }); commandToEventMapperRegistry.put(ModifyThing.class, (command, revision) -> { final ModifyThing modifyCommand = (ModifyThing) command; return ThingModified.of(modifyCommand.getThing(), revision, DittoHeaders.empty()); }); commandToEventMapperRegistry.put(DeleteThing.class, (command, revision) -> { final DeleteThing deleteCommand = (DeleteThing) command; return ThingDeleted.of(deleteCommand.getThingEntityId(), revision, DittoHeaders.empty()); }); }
Example #2
Source File: AbstractJsonifiableWithDittoHeadersSerializer.java From ditto with Eclipse Public License 2.0 | 6 votes |
/** * Constructs a new {@code AbstractJsonifiableWithDittoHeadersSerializer} object. * * @param identifier a unique identifier identifying the serializer. * @param actorSystem the ExtendedActorSystem to use in order to dynamically load mapping strategies. * @param manifestProvider a function for retrieving string manifest information from arbitrary to map objects. * @param serializerName a name to be used for this serializer when reporting metrics, in the log and in error * messages. */ protected AbstractJsonifiableWithDittoHeadersSerializer(final int identifier, final ExtendedActorSystem actorSystem, final Function<Object, String> manifestProvider, final String serializerName) { this.identifier = identifier; this.serializerName = serializerName; mappingStrategies = MappingStrategies.loadMappingStrategies(actorSystem); this.manifestProvider = checkNotNull(manifestProvider, "manifestProvider"); final ActorSystem.Settings settings = actorSystem.settings(); final Config config = settings.config(); defaultBufferSize = config.withFallback(FALLBACK_CONF).getBytes(CONFIG_DIRECT_BUFFER_SIZE); final int maxPoolEntries = config.withFallback(FALLBACK_CONF).getInt(CONFIG_DIRECT_BUFFER_POOL_LIMIT); byteBufferPool = new DirectByteBufferPool(defaultBufferSize.intValue(), maxPoolEntries); inCounter = DittoMetrics.counter(serializerName.toLowerCase() + METRIC_NAME_SUFFIX) .tag(METRIC_DIRECTION, "in"); outCounter = DittoMetrics.counter(serializerName.toLowerCase() + METRIC_NAME_SUFFIX) .tag(METRIC_DIRECTION, "out"); }
Example #3
Source File: PolicyPersistenceActorSnapshottingTest.java From ditto with Eclipse Public License 2.0 | 6 votes |
@Override protected void setup(final Config customConfig) { super.setup(customConfig); eventAdapter = new DefaultPolicyMongoEventAdapter((ExtendedActorSystem) actorSystem); journalTestHelper = new PoliciesJournalTestHelper<>(actorSystem, this::convertJournalEntryToEvent, PolicyPersistenceActorSnapshottingTest::convertDomainIdToPersistenceId); snapshotTestHelper = new PoliciesSnapshotTestHelper<>(actorSystem, PolicyPersistenceActorSnapshottingTest::convertSnapshotDataToPolicy, PolicyPersistenceActorSnapshottingTest::convertDomainIdToPersistenceId); commandToEventMapperRegistry = new HashMap<>(); commandToEventMapperRegistry.put(CreatePolicy.class, (command, revision) -> { final CreatePolicy createCommand = (CreatePolicy) command; return PolicyCreated.of(createCommand.getPolicy(), revision, DittoHeaders.empty()); }); commandToEventMapperRegistry.put(ModifyPolicy.class, (command, revision) -> { final ModifyPolicy modifyCommand = (ModifyPolicy) command; return PolicyModified.of(modifyCommand.getPolicy(), revision, DittoHeaders.empty()); }); commandToEventMapperRegistry.put(DeletePolicy.class, (command, revision) -> { final DeletePolicy deleteCommand = (DeletePolicy) command; return PolicyDeleted.of(deleteCommand.getEntityId(), revision, DittoHeaders.empty()); }); }
Example #4
Source File: ThingMongoEventAdapter.java From ditto with Eclipse Public License 2.0 | 5 votes |
public ThingMongoEventAdapter(@Nullable final ExtendedActorSystem system) { this.system = system; eventRegistry = GlobalEventRegistry.getInstance(); migrationMappings = new HashMap<>(); migrationMappings.put(FeatureModified.NAME, jsonObject -> migrateModifiedToCreated(jsonObject, FeatureCreated.TYPE)); migrationMappings.put(FeaturesModified.NAME, jsonObject -> migrateModifiedToCreated(jsonObject, FeaturesCreated.TYPE)); migrationMappings.put(THING_ACL_MODIFIED, ThingMongoEventAdapter::migrateId); migrationMappings.put(THING_ACL_ENTRY_DELETED, ThingMongoEventAdapter::migrateId); migrationMappings.put(THING_ACL_ENTRY_MODIFIED, jsonObject -> migrateModifiedToCreated(migrateId(jsonObject), AclEntryCreated.TYPE)); migrationMappings.put(THING_ATTRIBUTE_DELETED, jsonObject -> renameJsonPointer(ATTRIBUTE, migrateId(jsonObject))); migrationMappings.put(THING_ATTRIBUTE_MODIFIED, jsonObject -> renameValue(ATTRIBUTE, renameJsonPointer(ATTRIBUTE, migrateModifiedToCreated(migrateId(jsonObject), AttributeCreated.TYPE)))); migrationMappings.put(THING_ATTRIBUTES_DELETED, ThingMongoEventAdapter::migrateId); migrationMappings.put(THING_ATTRIBUTES_MODIFIED, jsonObject -> migrateModifiedToCreated(migrateId(jsonObject), AttributesCreated.TYPE)); migrationMappings.put(FeaturePropertyDeleted.NAME, jsonObject -> renameJsonPointer(PROPERTY, jsonObject)); migrationMappings.put(FeaturePropertyModified.NAME, jsonObject -> renameValue(PROPERTY, renameJsonPointer(PROPERTY, migrateModifiedToCreated(jsonObject, FeaturePropertyCreated.TYPE)))); migrationMappings.put(FeaturePropertiesModified.NAME, jsonObject -> migrateModifiedToCreated(jsonObject, FeaturePropertiesCreated.TYPE)); }
Example #5
Source File: DefaultMessageMapperFactory.java From ditto with Eclipse Public License 2.0 | 5 votes |
private DefaultMessageMapperFactory(final ConnectionId connectionId, final MappingConfig mappingConfig, final ExtendedActorSystem actorSystem, final List<MessageMapperExtension> messageMapperExtensions, final LoggingAdapter log) { this.connectionId = checkNotNull(connectionId); this.mappingConfig = checkNotNull(mappingConfig, "MappingConfig"); this.actorSystem = checkNotNull(actorSystem); this.messageMapperExtensions = checkNotNull(messageMapperExtensions); this.log = checkNotNull(log); }
Example #6
Source File: DefaultMessageMapperFactory.java From ditto with Eclipse Public License 2.0 | 5 votes |
/** * Creates a new factory and returns the instance * * @param connectionId ID of the connection. * @param actorSystem the actor system to use for mapping config + dynamicAccess. * @param mappingConfig the configuration of the mapping behaviour. * @param log the log adapter used for debug and warning logs. * @return the new instance. * @throws NullPointerException if any argument is {@code null}. */ public static DefaultMessageMapperFactory of(final ConnectionId connectionId, final ActorSystem actorSystem, final MappingConfig mappingConfig, final LoggingAdapter log) { final ExtendedActorSystem extendedActorSystem = (ExtendedActorSystem) actorSystem; final List<MessageMapperExtension> messageMapperExtensions = tryToLoadMessageMappersExtensions(extendedActorSystem); return new DefaultMessageMapperFactory(connectionId, mappingConfig, extendedActorSystem, messageMapperExtensions, log); }
Example #7
Source File: DefaultMessageMapperFactory.java From ditto with Eclipse Public License 2.0 | 5 votes |
private static List<MessageMapperExtension> tryToLoadMessageMappersExtensions( final ExtendedActorSystem actorSystem) { try { return loadMessageMapperExtensions(actorSystem.dynamicAccess()); } catch (final Exception e) { final String message = e.getClass().getCanonicalName() + ": " + e.getMessage(); throw MessageMapperConfigurationFailedException.newBuilder(message).build(); } }
Example #8
Source File: ConnectivitySignalEnrichmentProvider.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Override public ConnectivitySignalEnrichmentProvider createExtension(final ExtendedActorSystem system) { final SignalEnrichmentConfig signalEnrichmentConfig = DefaultSignalEnrichmentConfig.of( system.settings().config().getConfig(SIGNAL_ENRICHMENT_CONFIG_PATH)); return AkkaClassLoader.instantiate(system, ConnectivitySignalEnrichmentProvider.class, signalEnrichmentConfig.getProvider(), Arrays.asList(ActorSystem.class, SignalEnrichmentConfig.class), Arrays.asList(system, signalEnrichmentConfig) ); }
Example #9
Source File: AbstractPolicyMongoEventAdapter.java From ditto with Eclipse Public License 2.0 | 4 votes |
protected AbstractPolicyMongoEventAdapter(final Logger logger, @Nullable final ExtendedActorSystem system) { this.logger = logger; this.system = system; eventRegistry = GlobalEventRegistry.getInstance(); }
Example #10
Source File: ConnectivityMongoEventAdapter.java From ditto with Eclipse Public License 2.0 | 4 votes |
public ConnectivityMongoEventAdapter(final ExtendedActorSystem system) { super(system, createEventRegistry()); }
Example #11
Source File: SharedJsonifiableSerializerTest.java From ditto with Eclipse Public License 2.0 | 4 votes |
private static ExtendedActorSystem getActorSystem(final Class<?> implClass) { final Config cfg = ConfigFactory.parseMap(Map.of("ditto.mapping-strategy.implementation", implClass.getName())); return (ExtendedActorSystem) ExtendedActorSystem.create("test", cfg); }
Example #12
Source File: DefaultPolicyMongoEventAdapter.java From ditto with Eclipse Public License 2.0 | 4 votes |
public DefaultPolicyMongoEventAdapter(@Nullable final ExtendedActorSystem system) { super(LoggerFactory.getLogger(DefaultPolicyMongoEventAdapter.class), system); migrationMappings = new HashMap<>(); }
Example #13
Source File: ReplicationId.java From ts-reaktive with MIT License | 4 votes |
public Replication createExtension(ExtendedActorSystem system) { return new Replication(system); }
Example #14
Source File: SharedActorMaterializer.java From ts-reaktive with MIT License | 4 votes |
public SharedActorMaterializer createExtension(ExtendedActorSystem system) { return new SharedActorMaterializer(system); }
Example #15
Source File: SharedActorMaterializer.java From ts-reaktive with MIT License | 4 votes |
private SharedActorMaterializer(ExtendedActorSystem system) { this.materializer = ActorMaterializer.create(system); }
Example #16
Source File: AkkaSpringExtension.java From odata with Apache License 2.0 | 4 votes |
@Override public AkkaExtension createExtension(ExtendedActorSystem system) { return new AkkaExtension(); }
Example #17
Source File: SpringExtension.java From akka-java-springfactory with MIT License | 4 votes |
/** * Is used by Akka to instantiate the Extension identified by this * ExtensionId, internal use only. */ @Override public SpringExt createExtension(ExtendedActorSystem system) { return new SpringExt(); }
Example #18
Source File: SpringExtension.java From tutorials with MIT License | 4 votes |
@Override public SpringExt createExtension(ExtendedActorSystem system) { return new SpringExt(); }
Example #19
Source File: DistributedData.java From ditto with Eclipse Public License 2.0 | 4 votes |
@Override public abstract T createExtension(ExtendedActorSystem system);
Example #20
Source File: FlowerExtensionConfiguration.java From flower with Apache License 2.0 | 4 votes |
@Override public FlowerExtension createExtension(ExtendedActorSystem system) { return new FlowerExtension(system); }
Example #21
Source File: FlowerExtension.java From flower with Apache License 2.0 | 4 votes |
public FlowerExtension(ExtendedActorSystem system) { this.actorSystem = system; }
Example #22
Source File: HessianSerializationExtension.java From flower with Apache License 2.0 | 4 votes |
@Override public HessianSerializer createExtension(ExtendedActorSystem system) { return new HessianSerializer(); }
Example #23
Source File: SagaDataExtension.java From servicecomb-pack with Apache License 2.0 | 4 votes |
@Override public SagaDataExt createExtension(ExtendedActorSystem system) { return new SagaDataExt(); }
Example #24
Source File: SpringAkkaExtension.java From servicecomb-pack with Apache License 2.0 | 4 votes |
@Override public SpringExt createExtension(ExtendedActorSystem system) { return new SpringExt(); }
Example #25
Source File: ProtocolAdapterProvider.java From ditto with Eclipse Public License 2.0 | 4 votes |
/** * Loads the configured {@code ProtocolAdapterProvider} by reflection. * This calls the 1-argument constructor every subclass of ProtocolAdapterProvider should implement. * * @param protocolConfig provides the class name of the ProtocolAdapterProvider to be loaded. * @param actorSystem Akka actor system to perform reflection with. * @return the loaded protocol adapter provider. */ public static ProtocolAdapterProvider load(final ProtocolConfig protocolConfig, final ActorSystem actorSystem) { final String className = protocolConfig.getProviderClassName(); final ClassTag<ProtocolAdapterProvider> tag = ClassTag$.MODULE$.apply(ProtocolAdapterProvider.class); final List<Tuple2<Class<?>, Object>> constructorArgs = Collections.singletonList(new Tuple2<>(ProtocolConfig.class, protocolConfig)); final DynamicAccess dynamicAccess = ((ExtendedActorSystem) actorSystem).dynamicAccess(); final Try<ProtocolAdapterProvider> providerBox = dynamicAccess.createInstanceFor(className, JavaConverters.asScalaBuffer(constructorArgs).toList(), tag); return providerBox.get(); }
Example #26
Source File: AbstractPubSubFactory.java From ditto with Eclipse Public License 2.0 | 4 votes |
@Override public CompressedDDataHandler createExtension(final ExtendedActorSystem system) { return CompressedDDataHandler.create(system, getConfig(system), clusterRole, PubSubConfig.of(system)); }
Example #27
Source File: SpringExtension.java From spring-boot-akka-event-sourcing-starter with Apache License 2.0 | 4 votes |
/** * Is used by Akka to instantiate the Extension identified by this * ExtensionId, internal use only. */ @Override public SpringExt createExtension(ExtendedActorSystem system) { return new SpringExt(); }
Example #28
Source File: AbstractMongoEventAdapter.java From ditto with Eclipse Public License 2.0 | 4 votes |
protected AbstractMongoEventAdapter(final ExtendedActorSystem system, final EventRegistry<T> eventRegistry) { this.system = system; this.eventRegistry = eventRegistry; }
Example #29
Source File: BlockedNamespaces.java From ditto with Eclipse Public License 2.0 | 4 votes |
@Override public BlockedNamespaces createExtension(final ExtendedActorSystem system) { return new BlockedNamespaces(DistributedData.createConfig(system, ACTOR_NAME, CLUSTER_ROLE), system); }
Example #30
Source File: SharedJsonifiableSerializerTest.java From ditto with Eclipse Public License 2.0 | 4 votes |
@Override public AbstractJsonifiableWithDittoHeadersSerializer getInstance(final ExtendedActorSystem actorSystem) { return new JsonJsonifiableSerializer(actorSystem); }