Tabnine Logo
MessageDispatcher
Code IndexAdd Tabnine 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)

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

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • scheduleAtFixedRate (Timer)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • ImageIO (javax.imageio)
  • Notification (javax.management)
  • Top Vim plugins
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