This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| 'use strict' | |
| const inquirer = require('inquirer') | |
| const bench = require('./lib/bench') | |
| const { choices, list } = require('./lib/packages') | |
| const argv = process.argv.slice(2) | |
| async function select (callback) { | |
| const result = await inquirer.prompt([ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| max_payload: 10485760 | |
| streaming { | |
| store: "SQL" | |
| sql_options: { | |
| no_caching: true | |
| driver: "postgres" | |
| source: "dbname=mydb host=roach1 port=26257 user=test sslmode=disable readTimeout=5s writeTimeout=5s" | |
| } | |
| store_limits { | |
| max_subs: 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Subscribe starting with most recently published value | |
| sub, err := sc.Subscribe("eventstore.events", func(m *stan.Msg) { | |
| fmt.Printf("Received a message: %s\n", string(m.Data)) | |
| }, stan.StartWithLastReceived()) | |
| // Receive all stored values in order | |
| sub, err := sc.Subscribe("eventstore.events", func(m *stan.Msg) { | |
| fmt.Printf("Received a message: %s\n", string(m.Data)) | |
| }, stan.DeliverAllAvailable()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub, err := sc.Subscribe("eventstore.events", func(m *stan.Msg) { | |
| fmt.Printf("Received a message: %s\n", string(m.Data)) | |
| // your code | |
| if err := m.Ack(); err != nil { | |
| // event is redelivered | |
| return | |
| } | |
| }, | |
| stan.maxInFlight(1), | |
| stan.AckWait("30s"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub, err := sc.Subscribe("eventstore.events", func(m *stan.Msg) { | |
| // TODO check if event was already processed | |
| stan.PublishAsync("eventstore.events.order-projection", m.Data) | |
| stan.PublishAsync("eventstore.events.order-reactor", m.Data) | |
| // TODO track event as processed | |
| // ack message | |
| if err := m.Ack(); err != nil { | |
| log.WithFields(eventLogFields).WithFields(r.baseLogFields).WithError(err).Error("ack event") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| id | version | data | timestamp | |
| +----+---------+----------------------------------------------------------------+---------------------+ | |
| 1 | 1 | {"PositionID": "Auftragsfreigabe", "PositionOrderID": "A1212"} | 1578079632531167629 | |
| 1 | 2 | {"PositionID": "Abteilung A", "PositionOrderID": "A1213"} | 1578079669618870080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub, err := sc.Subscribe("eventstore.events", func(m *stan.Msg) { | |
| // check if event was already processed | |
| if p.tracker.IsDuplicateOperation(p.name, event.ID) { | |
| log.WithFields(eventLogFields).WithFields(subLogFields).Trace("duplicate") | |
| if err := m.Ack(); err != nil { | |
| log.WithFields(eventLogFields).WithFields(subLogFields).WithError(err).Error("ack duplicate event") | |
| } | |
| return | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| id | last_processed_event_id | processor_name | |
| +--------------------+----------------------------+-----------------+ | |
| 517800172974768129 | 01DXRWAVGFZ46AV38EA2CYXFQJ | reactor | |
| 517800173095550977 | 01DXRWAVGFZ46AV38EA2CYXFQJ | order-projector |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func (c *CommandBus) HandleCommand(cmd Command) { | |
| events := c.CommandHandler.HandleCommand(cmd) | |
| c.stan.Publish("eventstore.events", events) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ################### | |
| // #### React hook ###### | |
| // ################### | |
| import { useEffect, useRef, useState } from 'react'; | |
| /* eslint-disable global-require */ | |
| const Places = typeof window !== 'undefined' && require('places.js'); | |
| export default function useAlgoliaPlaces({ options, events }) { |