congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ShardedMessageEnvelope.of
Code IndexAdd Tabnine to your IDE (free)

How to use
of
method
in
org.eclipse.ditto.signals.base.ShardedMessageEnvelope

Best Java code snippets using org.eclipse.ditto.signals.base.ShardedMessageEnvelope.of (Showing top 9 results out of 315)

origin: org.eclipse.ditto/ditto-signals-base

@Override
public ShardedMessageEnvelope setDittoHeaders(final DittoHeaders dittoHeaders) {
  return of(id, type, message, dittoHeaders);
}
origin: eclipse/ditto

@Override
public ShardedMessageEnvelope setDittoHeaders(final DittoHeaders dittoHeaders) {
  return of(id, type, message, dittoHeaders);
}
origin: org.eclipse.ditto/ditto-services-thingsearch-updater-actors

private <M> void forwardToShardRegion(final M message,
    final Function<M, String> getId,
    final Function<M, String> getType,
    final Function<M, JsonObject> toJson,
    final Function<M, DittoHeaders> getDittoHeaders) {
  final String id = getId.apply(message);
  log.debug("Forwarding incoming {} to shard region of {}", message.getClass().getSimpleName(), id);
  final String type = getType.apply(message);
  final JsonObject jsonObject = toJson.apply(message);
  final DittoHeaders dittoHeaders = getDittoHeaders.apply(message);
  final ShardedMessageEnvelope messageEnvelope = ShardedMessageEnvelope.of(id, type, jsonObject, dittoHeaders);
  shardRegion.forward(messageEnvelope, context());
}
origin: eclipse/ditto

private <M> void forwardToShardRegion(final M message,
    final Function<M, String> getId,
    final Function<M, String> getType,
    final Function<M, JsonObject> toJson,
    final Function<M, DittoHeaders> getDittoHeaders) {
  final String id = getId.apply(message);
  log.debug("Forwarding incoming {} to shard region of {}", message.getClass().getSimpleName(), id);
  final String type = getType.apply(message);
  final JsonObject jsonObject = toJson.apply(message);
  final DittoHeaders dittoHeaders = getDittoHeaders.apply(message);
  final ShardedMessageEnvelope messageEnvelope = ShardedMessageEnvelope.of(id, type, jsonObject, dittoHeaders);
  final ActorRef sender = getSender();
  final ActorRef deadLetters = getContext().getSystem().deadLetters();
  namespaceBlockingBehavior
      .block(messageEnvelope)
      .thenAccept(m -> shardRegion.tell(m, sender))
      .exceptionally(throwable -> {
        if (!Objects.equals(sender, deadLetters)) {
          // Only acknowledge IdentifiableStreamingMessage. No other messages should be acknowledged.
          if (message instanceof IdentifiableStreamingMessage) {
            final StreamAck streamAck =
                StreamAck.success(((IdentifiableStreamingMessage) message).asIdentifierString());
            sender.tell(streamAck, getSelf());
          }
        }
        return null;
      });
}
origin: eclipse/ditto

  private static ShardedMessageEnvelope createEnvelope(final EntityId entityId, final Signal<?> signal) {
    return ShardedMessageEnvelope.of(
        entityId.toString(),
        signal.getType(),
        signal.toJson(signal.getImplementedSchemaVersion(), FieldType.regularOrSpecial()),
        signal.getDittoHeaders());
  }
}
origin: eclipse/ditto

/**
 * Returns a new {@code ShardedMessageEnvelope} parsed from the specified {@code jsonObject}.
 *
 * @param jsonObject the JSON object.
 * @return the ShardedMessageEnvelope.
 */
public static ShardedMessageEnvelope fromJson(final JsonObject jsonObject) {
  final String extractedId = jsonObject.getValueOrThrow(JSON_ID);
  final String extractedType = jsonObject.getValueOrThrow(JSON_TYPE);
  final JsonObject extractedMessage = jsonObject.getValueOrThrow(JSON_MESSAGE);
  final JsonObject jsonDittoHeaders = jsonObject.getValueOrThrow(JSON_DITTO_HEADERS);
  final DittoHeaders extractedDittoHeaders = DittoHeaders.newBuilder(jsonDittoHeaders).build();
  return of(extractedId, extractedType, extractedMessage, extractedDittoHeaders);
}
origin: org.eclipse.ditto/ditto-signals-base

/**
 * Returns a new {@code ShardedMessageEnvelope} parsed from the specified {@code jsonObject}.
 *
 * @param jsonObject the JSON object.
 * @return the ShardedMessageEnvelope.
 */
public static ShardedMessageEnvelope fromJson(final JsonObject jsonObject) {
  final String extractedId = jsonObject.getValueOrThrow(JSON_ID);
  final String extractedType = jsonObject.getValueOrThrow(JSON_TYPE);
  final JsonObject extractedMessage = jsonObject.getValueOrThrow(JSON_MESSAGE);
  final JsonObject jsonDittoHeaders = jsonObject.getValueOrThrow(JSON_DITTO_HEADERS);
  final DittoHeaders extractedDittoHeaders = DittoHeaders.newBuilder(jsonDittoHeaders).build();
  return of(extractedId, extractedType, extractedMessage, extractedDittoHeaders);
}
origin: eclipse/ditto

private void retrieveThing() {
  final DittoHeaders dittoHeaders = DittoHeaders.newBuilder()
      .correlationId("thingUpdater-sudoRetrieveThing-" + UUID.randomUUID())
      .build();
  final SudoRetrieveThing sudoRetrieveThingCmd = SudoRetrieveThing.withOriginalSchemaVersion(thingId,
      dittoHeaders);
  final String cmdType = sudoRetrieveThingCmd.getType();
  final JsonSchemaVersion implementedSchemaVersion = sudoRetrieveThingCmd.getImplementedSchemaVersion();
  final Predicate<JsonField> regularOrSpecialFields = FieldType.regularOrSpecial();
  final JsonObject cmdJsonObject = sudoRetrieveThingCmd.toJson(implementedSchemaVersion, regularOrSpecialFields);
  final Object messageEnvelope = ShardedMessageEnvelope.of(thingId, cmdType, cmdJsonObject, dittoHeaders);
  // Send a message directly to the Things Shard Region.
  thingsShardRegion.tell(messageEnvelope, getSelf());
}
origin: org.eclipse.ditto/ditto-services-thingsearch-updater-actors

private void retrieveThing() {
  final DittoHeaders dittoHeaders = DittoHeaders.newBuilder()
      .correlationId("thingUpdater-sudoRetrieveThing-" + UUID.randomUUID())
      .build();
  final SudoRetrieveThing sudoRetrieveThingCmd = SudoRetrieveThing.withOriginalSchemaVersion(thingId,
      dittoHeaders);
  final String cmdType = sudoRetrieveThingCmd.getType();
  final JsonSchemaVersion implementedSchemaVersion = sudoRetrieveThingCmd.getImplementedSchemaVersion();
  final Predicate<JsonField> regularOrSpecialFields = FieldType.regularOrSpecial();
  final JsonObject cmdJsonObject = sudoRetrieveThingCmd.toJson(implementedSchemaVersion, regularOrSpecialFields);
  final Object messageEnvelope = ShardedMessageEnvelope.of(thingId, cmdType, cmdJsonObject, dittoHeaders);
  // Send a message directly to the Things Shard Region.
  thingsShardRegion.tell(messageEnvelope, getSelf());
}
org.eclipse.ditto.signals.baseShardedMessageEnvelopeof

Javadoc

Returns a new ShardedMessageEnvelope for the specified id and message.

Popular methods of ShardedMessageEnvelope

  • <init>
  • fromJson
    Returns a new ShardedMessageEnvelope parsed from the specified jsonObject.
  • getDittoHeaders
  • getId
    Returns the ID of the envelope.
  • getMessage
    Returns the message of the envelope.
  • getType
    Returns the type of the message.

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now