How to use @node-ts/bus-core - 10 common examples

To help you get started, we’ve selected a few @node-ts/bus-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-ts / bus-starter / src / workflows / siren-test-workflow.ts View on Github external
constructor (
    @inject(BUS_SYMBOLS.Bus) private readonly bus: Bus
  ) {
    super()
  }
github node-ts / bus / packages / bus-sqs / src / sqs-transport.integration.ts View on Github external
it('should receive and dispatch to the handler', async () => {
        await sleep(1000 * 2)
        handleChecker.verify(
          h => h.check(It.isObjectWith(messageOptions)),
          Times.once()
        )
      })
    })
github node-ts / bus / packages / bus-workflow / src / workflow / workflow-misconfigured.integration.ts View on Github external
container.load(new LoggerModule())
    container.load(new BusModule())
    container.load(new BusWorkflowModule())
    logger = Mock.ofType()
    container.rebind(LOGGER_SYMBOLS.Logger).toConstantValue(logger.object)

    persistence = container.get(BUS_WORKFLOW_SYMBOLS.Persistence)

    const workflowRegistry = container.get(BUS_WORKFLOW_SYMBOLS.WorkflowRegistry)
    workflowRegistry.register(TestWorkflowMisconfigured, TestWorkflowMisconfiguredData)
    await workflowRegistry.initializeWorkflows()

    bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
    await bootstrap.initialize(container)

    bus = container.get(BUS_SYMBOLS.Bus)
    await bus.send(command)
    await sleep(CONSUME_TIMEOUT)
  })
github node-ts / bus-starter / src / index.ts View on Github external
async function runDemo (): Promise {
  const bus = container.get(BUS_SYMBOLS.Bus)
  await bus.send(new StartSirenTest(generateUuid()))
}
github node-ts / bus / packages / bus-workflow / src / workflow / decorators / started.spec.ts View on Github external
c => ({
    bus: c.get(BUS_SYMBOLS.Bus),
    logger: c.get(LOGGER_SYMBOLS.Logger)
  })
)
github node-ts / bus / packages / bus-rabbitmq / src / rabbitmq-transport.integration.ts View on Github external
beforeAll(async () => {
    container = new TestContainer()
    container.bind(BUS_RABBITMQ_SYMBOLS.TransportConfiguration).toConstantValue(configuration)
    bus = container.get(BUS_SYMBOLS.Bus)
    sut = container.get(BUS_SYMBOLS.Transport)

    bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
    bootstrap.registerHandler(TestCommandHandler)

    const connectionFactory = container.get<() => Promise>(BUS_RABBITMQ_INTERNAL_SYMBOLS.AmqpFactory)
    connection = await connectionFactory()
    channel = await connection.createChannel()

    await bootstrap.initialize(container)
  })
github node-ts / bus / packages / bus-postgres / src / postgres-persistence.integration.ts View on Github external
beforeAll(async () => {
    container = new TestContainer()
    container.bind(BUS_POSTGRES_SYMBOLS.PostgresConfiguration).toConstantValue(configuration)
    bus = container.get(BUS_SYMBOLS.Bus)
    sut = container.get(BUS_WORKFLOW_SYMBOLS.Persistence)
    postgres = container.get(BUS_POSTGRES_INTERNAL_SYMBOLS.PostgresPool)

    workflows = container.get(BUS_WORKFLOW_SYMBOLS.WorkflowRegistry)
    workflows.register(TestWorkflow, TestWorkflowData)
    await workflows.initializeWorkflows()

    bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
    await bootstrap.initialize(container)
  })
github node-ts / bus / packages / bus-workflow / src / workflow / decorators / started.spec.ts View on Github external
container = new Container()
    container.load(new LoggerModule())
    container.load(new BusModule())
    container.load(new BusWorkflowModule())
    container.rebind(LOGGER_SYMBOLS.Logger).toConstantValue(Mock.ofType().object)

    persistence = container.get(BUS_WORKFLOW_SYMBOLS.Persistence)

    const workflowRegistry = container.get(BUS_WORKFLOW_SYMBOLS.WorkflowRegistry)
    await workflowRegistry.registerFunctional(assignmentWorkflow)
    await workflowRegistry.initializeWorkflows()

    bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
    await bootstrap.initialize(container)

    bus = container.get(BUS_SYMBOLS.Bus)
    await bus.send(event)
    await sleep(CONSUME_TIMEOUT)
  })
github node-ts / bus / packages / bus-sqs / src / sqs-transport.integration.ts View on Github external
beforeAll(async () => {
    container = new TestContainer()
    container.bind(BUS_SQS_SYMBOLS.SqsConfiguration).toConstantValue(sqsConfiguration)
    sut = container.get(BUS_SYMBOLS.Transport)
    sqs = container.get(BUS_SQS_INTERNAL_SYMBOLS.Sqs)
    sns = container.get(BUS_SQS_INTERNAL_SYMBOLS.Sns)
    bus = container.get(BUS_SYMBOLS.Bus)
    bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)

    handleChecker = Mock.ofType()
    container.bind(HANDLE_CHECKER).toConstantValue(handleChecker.object)

    bootstrap.registerHandler(TestCommandHandler)
  })
github node-ts / bus / packages / bus-workflow / src / workflow / workflow.integration.ts View on Github external
container.load(new BusModule())
    container.load(new BusWorkflowModule())
    container.rebind(LOGGER_SYMBOLS.Logger).toConstantValue(Mock.ofType().object)

    persistence = container.get(BUS_WORKFLOW_SYMBOLS.Persistence)

    const workflowRegistry = container.get(BUS_WORKFLOW_SYMBOLS.WorkflowRegistry)
    workflowRegistry.register(TestWorkflow, TestWorkflowData)
    workflowRegistry.register(TestWorkflowStartedByCompletes, TestWorkflowStartedByCompletesData)
    workflowRegistry.register(TestWorkflowStartedByDiscard, TestWorkflowStartedByDiscardData)
    await workflowRegistry.initializeWorkflows()

    bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
    await bootstrap.initialize(container)

    bus = container.get(BUS_SYMBOLS.Bus)
    await bus.send(command)
    await sleep(CONSUME_TIMEOUT)
  })