📘
@node-test/bus
  • @node-ts/bus
  • Getting started
    • Installation
    • Handling messages
    • Shutting down cleanly
  • Reference
    • Bus
    • BusConfiguration
    • BusInstance
  • Getting help
  • Guide
    • Messages
      • Events
      • Commands
      • System messages
    • Message attributes
      • Correlation id
      • Attributes
      • Sticky attributes
    • Workflows
      • Creating a workflow
      • Starting
      • Handling
      • State
      • Completing
      • Example
    • Transports
      • RabbitMQ
      • Amazon SQS
      • Redis
      • Custom transports
    • Persistence
      • Postgres
      • MongoDB
      • Creating a persistence
    • Serializers
      • Class serializer
    • Loggers
      • Custom loggers
    • Middleware
    • Lifecycle hooks
    • Retry Strategies
    • Dependency injection
    • Long running processes
Powered by GitBook
On this page

Was this helpful?

  1. Guide
  2. Transports

Redis

Redis can be used as a message transport by installing the @node-ts/bus-redis package. This will configure Redis to use lists as de-facto message queues and route messages according to your application handlers.

Installation

Install the @node-ts/bus-redis package

npm install @node-ts/bus-redis

Configure the Redis transport and provide it to the bus configuration

import { Bus } from '@node-ts/bus-core'
import { RedisTransport, RedisTransportConfiguration } from '@node-ts/bus-redis'

const redisTransportConfiguration: RedisTransportConfiguration = {
  queueName: 'accounts-application-queue',
  connectionString: 'redis://127.0.0.1:6379',
  maxRetries: 3
}
const redisTransport = new RedisTransport(redisTransportConfiguration)
await Bus
  .configure()
  .withTransport(redisTransport)
  .initialize()
PreviousAmazon SQSNextCustom transports

Last updated 3 years ago

Was this helpful?