Codota Logo
MessageDispatcher
Code IndexAdd Codota to your IDE (free)

How to use
MessageDispatcher
in
de.otto.synapse.consumer

Best Java code snippets using de.otto.synapse.consumer.MessageDispatcher (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: de.otto.synapse/synapse-core

public AbstractMessageReceiverEndpoint(final @Nonnull String channelName,
                    final @Nonnull MessageInterceptorRegistry interceptorRegistry,
                    final @Nullable ApplicationEventPublisher eventPublisher) {
  super(channelName, interceptorRegistry);
  messageDispatcher = new MessageDispatcher();
  this.eventPublisher = eventPublisher;
}
origin: de.otto.synapse/synapse-core

/**
 * Registers a MessageConsumer at the receiver endpoint.
 *
 * {@link MessageConsumer consumers} have to be thread safe as they might be called from multiple threads
 * in parallel (e.g. for kinesis streams there is one thread per shard).
 *
 * @param messageConsumer registered EventConsumer
 */
@Override
public final void register(MessageConsumer<?> messageConsumer) {
  messageDispatcher.add(messageConsumer);
}
origin: de.otto.synapse/synapse-core

private CompletableFuture<ChannelPosition> consumeMessageStore() {
  final ThreadFactory threadFactory = new CustomizableThreadFactory("synapse-eventsource-");
  return CompletableFuture.supplyAsync(() -> {
    messageStore.stream().forEach(message -> {
      final Message<String> interceptedMessage = getMessageLogReceiverEndpoint().getInterceptorChain().intercept(message);
      if (interceptedMessage != null) {
        getMessageLogReceiverEndpoint().getMessageDispatcher().accept(interceptedMessage);
      }
    });
    return messageStore.getLatestChannelPosition();
  }, newSingleThreadExecutor(threadFactory));
}
origin: de.otto.synapse/synapse-core

messageConsumers
    .stream()
    .filter(consumer -> matchesKeyPattern(message, consumer.keyPattern()))
    .forEach((MessageConsumer consumer) -> {
      try {
origin: de.otto.synapse/synapse-testsupport

final Message<String> interceptedMessage = intercept(receivedMessage);
if (interceptedMessage != null) {
  getMessageDispatcher().accept(interceptedMessage);
origin: de.otto.synapse/synapse-testsupport

getMessageDispatcher().accept(interceptedMessage);
origin: de.otto.synapse/synapse-aws-kinesis

@Override
public void accept(final ShardResponse response) {
  final InterceptorChain interceptorChain = interceptorRegistry.getInterceptorChain(channelName, RECEIVER);
  response.getMessages().forEach(message -> {
    try {
      final Message<String> interceptedMessage = interceptorChain.intercept(message);
      if (interceptedMessage != null) {
        messageDispatcher.accept(interceptedMessage);
      }
    } catch (final Exception e) {
      LOG.error("Error processing message: " + e.getMessage(), e);
    }
  });
  channelDurationBehind.updateAndGet(behind -> copyOf(behind)
      .with(response.getShardName(), response.getDurationBehind())
      .build());
  if (eventPublisher != null) {
    eventPublisher.publishEvent(builder()
        .withChannelName(channelName)
        .withChannelDurationBehind(channelDurationBehind.get())
        .withStatus(RUNNING)
        .withMessage("Reading from kinesis shard.")
        .build());
  }
}
de.otto.synapse.consumerMessageDispatcher

Javadoc

A MessageConsumer that is acting as a Message Dispatcher for multiple MessageConsumer.

As it is implementing the MessageConsumer interface, the MessageDispatcher is an implementation of the GoF Composite Pattern.

Messages are translated by the dispatcher using to the format expected by the registered consumers.

Most used methods

  • accept
    Accepts a message with JSON String payload, dispatches this method to the different registered Messa
  • <init>
  • add
  • matchesKeyPattern

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Socket (java.net)
    Provides a client-side TCP socket.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JPanel (javax.swing)
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now