Class RedisTransporter

All Implemented Interfaces:
io.lettuce.core.event.EventBus, io.lettuce.core.pubsub.RedisPubSubListener<byte[],byte[]>, MetricConstants, MoleculerLifecycle

public class RedisTransporter extends Transporter implements io.lettuce.core.event.EventBus, io.lettuce.core.pubsub.RedisPubSubListener<byte[],byte[]>
Redis Transporter. Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker (website: https://redis.io). Usage:
ServiceBroker broker = ServiceBroker.builder().nodeID("node1")
.transporter(new RedisTransporter("localhost")).build();
Required dependency:

// https://mvnrepository.com/artifact/biz.paluch.redis/lettuce
compile group: 'biz.paluch.redis', name: 'lettuce', version: '4.5.0.Final'
See Also:
  • Field Details

  • Constructor Details

    • RedisTransporter

      public RedisTransporter()
    • RedisTransporter

      public RedisTransporter(String... urls)
    • RedisTransporter

      public RedisTransporter(String password, boolean secure, String... urls)
  • Method Details

    • connect

      public void connect()
      Specified by:
      connect in class Transporter
    • unableToConnect

      protected void unableToConnect(Exception cause)
    • disconnect

      protected io.datatree.Promise disconnect()
    • reconnect

      protected void reconnect()
    • error

      protected void error(Throwable cause)
      Description copied from class: Transporter
      Any I/O error occurred. Implementation-specific error handling goes here (reconnection, etc.).
      Overrides:
      error in class Transporter
      Parameters:
      cause - I/O error
    • stopped

      public void stopped()
      Closes transporter.
      Specified by:
      stopped in interface MoleculerLifecycle
      Overrides:
      stopped in class Transporter
    • subscribe

      public io.datatree.Promise subscribe(String channel)
      Specified by:
      subscribe in class Transporter
    • publish

      public void publish(String channel, io.datatree.Tree message)
      Specified by:
      publish in class Transporter
    • message

      public void message(byte[] channel, byte[] message)
      Specified by:
      message in interface io.lettuce.core.pubsub.RedisPubSubListener<byte[],byte[]>
    • message

      public void message(byte[] pattern, byte[] channel, byte[] message)
      Specified by:
      message in interface io.lettuce.core.pubsub.RedisPubSubListener<byte[],byte[]>
    • subscribed

      public void subscribed(byte[] channel, long count)
      Specified by:
      subscribed in interface io.lettuce.core.pubsub.RedisPubSubListener<byte[],byte[]>
    • psubscribed

      public void psubscribed(byte[] pattern, long count)
      Specified by:
      psubscribed in interface io.lettuce.core.pubsub.RedisPubSubListener<byte[],byte[]>
    • unsubscribed

      public void unsubscribed(byte[] channel, long count)
      Specified by:
      unsubscribed in interface io.lettuce.core.pubsub.RedisPubSubListener<byte[],byte[]>
    • punsubscribed

      public void punsubscribed(byte[] pattern, long count)
      Specified by:
      punsubscribed in interface io.lettuce.core.pubsub.RedisPubSubListener<byte[],byte[]>
    • publish

      public void publish(io.lettuce.core.event.Event event)
      Specified by:
      publish in interface io.lettuce.core.event.EventBus
    • get

      public reactor.core.publisher.Flux<io.lettuce.core.event.Event> get()
      Specified by:
      get in interface io.lettuce.core.event.EventBus
    • getUrls

      public String[] getUrls()
    • setUrls

      public void setUrls(String[] urls)
    • getPassword

      public String getPassword()
    • setPassword

      public void setPassword(String password)
    • isSecure

      public boolean isSecure()
    • setSecure

      public void setSecure(boolean secure)