Search in sources :

Example 1 with DISTRIBUTED_PARTITIONED

use of com.hazelcast.jet.impl.pipeline.SinkImpl.Type.DISTRIBUTED_PARTITIONED in project hazelcast by hazelcast.

the class CdcSinks method sink.

@Nonnull
private static <K, V> Sink<ChangeRecord> sink(@Nonnull String name, @Nonnull String map, @Nullable ClientConfig clientConfig, @Nonnull FunctionEx<? super ChangeRecord, ? extends K> keyFn, @Nonnull FunctionEx<? super ChangeRecord, ? extends V> valueFn) {
    FunctionEx<? super ChangeRecord, ? extends V> toValueFn = record -> DELETE.equals(record.operation()) ? null : valueFn.apply(record);
    String clientXml = asXmlString(clientConfig);
    ProcessorSupplier supplier = AbstractHazelcastConnectorSupplier.ofMap(clientXml, procFn(name, map, clientXml, keyFn, toValueFn));
    ProcessorMetaSupplier metaSupplier = ProcessorMetaSupplier.of(mapUpdatePermission(clientXml, name), supplier);
    return new SinkImpl<>(name, metaSupplier, DISTRIBUTED_PARTITIONED, keyFn);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) FunctionEx(com.hazelcast.function.FunctionEx) DELETE(com.hazelcast.jet.cdc.Operation.DELETE) ProcessorMetaSupplier(com.hazelcast.jet.core.ProcessorMetaSupplier) Processor(com.hazelcast.jet.core.Processor) DISTRIBUTED_PARTITIONED(com.hazelcast.jet.impl.pipeline.SinkImpl.Type.DISTRIBUTED_PARTITIONED) Collections.singletonList(java.util.Collections.singletonList) PermissionsUtil.mapUpdatePermission(com.hazelcast.security.PermissionsUtil.mapUpdatePermission) List(java.util.List) Permission(java.security.Permission) AbstractHazelcastConnectorSupplier(com.hazelcast.jet.impl.connector.AbstractHazelcastConnectorSupplier) HazelcastProperty(com.hazelcast.spi.properties.HazelcastProperty) ClientConfig(com.hazelcast.client.config.ClientConfig) ImdgUtil.asXmlString(com.hazelcast.jet.impl.util.ImdgUtil.asXmlString) Nonnull(javax.annotation.Nonnull) ProcessorSupplier(com.hazelcast.jet.core.ProcessorSupplier) SinkImpl(com.hazelcast.jet.impl.pipeline.SinkImpl) Sink(com.hazelcast.jet.pipeline.Sink) Nullable(javax.annotation.Nullable) SECONDS(java.util.concurrent.TimeUnit.SECONDS) WriteCdcP(com.hazelcast.jet.cdc.impl.WriteCdcP) IMap(com.hazelcast.map.IMap) SinkImpl(com.hazelcast.jet.impl.pipeline.SinkImpl) ImdgUtil.asXmlString(com.hazelcast.jet.impl.util.ImdgUtil.asXmlString) ProcessorSupplier(com.hazelcast.jet.core.ProcessorSupplier) ProcessorMetaSupplier(com.hazelcast.jet.core.ProcessorMetaSupplier) Nonnull(javax.annotation.Nonnull)

Aggregations

ClientConfig (com.hazelcast.client.config.ClientConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 FunctionEx (com.hazelcast.function.FunctionEx)1 DELETE (com.hazelcast.jet.cdc.Operation.DELETE)1 WriteCdcP (com.hazelcast.jet.cdc.impl.WriteCdcP)1 Processor (com.hazelcast.jet.core.Processor)1 ProcessorMetaSupplier (com.hazelcast.jet.core.ProcessorMetaSupplier)1 ProcessorSupplier (com.hazelcast.jet.core.ProcessorSupplier)1 AbstractHazelcastConnectorSupplier (com.hazelcast.jet.impl.connector.AbstractHazelcastConnectorSupplier)1 SinkImpl (com.hazelcast.jet.impl.pipeline.SinkImpl)1 DISTRIBUTED_PARTITIONED (com.hazelcast.jet.impl.pipeline.SinkImpl.Type.DISTRIBUTED_PARTITIONED)1 ImdgUtil.asXmlString (com.hazelcast.jet.impl.util.ImdgUtil.asXmlString)1 Sink (com.hazelcast.jet.pipeline.Sink)1 IMap (com.hazelcast.map.IMap)1 PermissionsUtil.mapUpdatePermission (com.hazelcast.security.PermissionsUtil.mapUpdatePermission)1 HazelcastProperty (com.hazelcast.spi.properties.HazelcastProperty)1 Permission (java.security.Permission)1 Collections.singletonList (java.util.Collections.singletonList)1 List (java.util.List)1 SECONDS (java.util.concurrent.TimeUnit.SECONDS)1