27 lines
582 B
JavaScript
27 lines
582 B
JavaScript
|
import { MessageBroker } from '../build/esm/index.js';
|
||
|
|
||
|
const broker = new MessageBroker({
|
||
|
createLogger: () =>
|
||
|
{
|
||
|
return {
|
||
|
debug: console.log,
|
||
|
info: console.log,
|
||
|
status: console.log,
|
||
|
warn: console.log,
|
||
|
error: console.error
|
||
|
};
|
||
|
}
|
||
|
}, {
|
||
|
load: true,
|
||
|
host: 'rabbitmq-01.stylis.local',
|
||
|
user: 'stylis',
|
||
|
pass: 'RrwJyrfeXFMimDH3hjZ5xSreMAmXtQJj',
|
||
|
vhost: 'development',
|
||
|
port: 5672
|
||
|
});
|
||
|
|
||
|
await broker.init();
|
||
|
broker.subscribe('chatlogs', (message) =>
|
||
|
{
|
||
|
console.log(message);
|
||
|
});
|