import { createMicroservice } from '@marblejs/messaging';
createMicroservice :: CreateMicroserviceConfig
-> Promise<ServerIO<TransportLayerConnection>>
StrategyOptions (Transport.AMQP
)
StrategyOptions (Transport.REDIS
)
import { IO } from 'fp-ts/lib/IO';
import { createMicroservice, messagingListener, Transport } from '@marblejs/messaging';
const amqpMicroservice = createMicroservice({
transport: Transport.AMQP,
options: {
host: 'amqp://localhost:5672',
queue: 'some_queue_name',
queueOptions: { durable: true },
timeout: 360 * 1000,
},
listener: messagingListener(...),
dependencies: [...],
});
const main: IO<void> = async () =>
(await amqpMicroservice)()
main();
import { IO } from 'fp-ts/lib/IO';
import { createMicroservice, messagingListener, Transport } from '@marblejs/messaging';
const redisMicroservice = createMicroservice({
transport: Transport.REDIS,
options: {
host: 'redis://127.0.0.1:6379',
channel: 'some_channelname',
timeout: 360 * 1000,
},
listener: messagingListener(...),
dependencies: [...],
});
const main: IO<void> = async () =>
(await redisMicroservice)()
main();