Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* added docs draft

* fixed netlify config

* moved netlify.toml to proper dir

* added extra hugo config for netlify

* fix netlify configs

* fixed build command dir

* added support page

* added snippets support

* added config snippets

* [docs] fixed examples

* updated build script to load snippets

* fixed syntax coloring

* added serializer sections for pub/sub implementations

* fixed code style

* [docs] getting started update

* [docs] added basic router info in getting started

* [docs] added router example to getting started

* [StdLoggerAdapter] fixed error logging

* [docs] added what is watermill

* [docs] simplified getting started router example

* [docs] added printMessage to snippet in getting started

* [docs][getting-started] added examples link

* [docs] added google analytics

* [docs] added more docs

* [docs] added missing docs

* [docs] added some links

* [docs] linking snippets to line in github

* [godoc] added watermill.io info

* [docs] added link to getting started in implenting pub/sub todos

* [examples] added docker-compose for simple-app

* [docs] added router schema

* [docs] added macOS librdkafka install instructions

* [docs] update grammer

* [docs] some cosmetics

* fix hugo build

* fix netlify config

* added hugo version at build

* [netlify] fix printing hugo version

* [netlify] fixed env

* [netlify] fixed hugo version
  • Loading branch information
roblaszczak authored and m110 committed Dec 12, 2018
1 parent 882728c commit cfdafe8
Show file tree
Hide file tree
Showing 60 changed files with 1,900 additions and 202 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.idea
vendor
docs/themes/
docs/public/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ You can find more about our motivations in our [*Introducing Watermill* blog pos
* **Easy** to understand (see examples below).
* **Universal** - event-driven architecture, messaging, stream processing, CQRS - use it for whatever you need.
* **Fast** - *(benchmarks coming soon)*
* **Extendable** with middlewares and plugins.
* **Resillient** - using proven technologies and passing stress tests *(results coming soon)*.
* **Flexible** with middlewares and plugins.
* **Resilient** - using proven technologies and passing stress tests *(results coming soon)*.

## Pub/Subs

Expand Down Expand Up @@ -92,7 +92,7 @@ and submit your pull request via GitHub.

## Support

Join us on the `#watermill` channel on the [Gophers slack](https://gophers.slack.com/): https://gophersinvite.herokuapp.com/
Please join us on the `#watermill` channel on the [Gophers slack](https://gophers.slack.com/): You can get invite [here](https://gophersinvite.herokuapp.com/).

## Why the name?

Expand Down
15 changes: 15 additions & 0 deletions _examples/simple-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Simple app

This app has separated publisher - [`publishing-app`](publishing-app/) and [`subscribing-app`](subscribing-app/).

Warning: Subscribing app has throttling middleware enabled.

## Requirements

To run this example you will need Docker and docker-compose installed. See installation guide at https://docs.docker.com/compose/install/

## Running

```bash
docker-compose up
```
42 changes: 42 additions & 0 deletions _examples/simple-app/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3'
services:
publishing:
image: threedotslabs/golang-librdkafka:1.11.2-stretch
restart: on-failure
depends_on:
- kafka
volumes:
- .:/app
working_dir: /app/publishing-app/
command: go run main.go

subscribing:
image: threedotslabs/golang-librdkafka:1.11.2-stretch
restart: on-failure
depends_on:
- kafka
volumes:
- .:/app
working_dir: /app/subscribing-app/
command: go run main.go

zookeeper:
image: confluentinc/cp-zookeeper:latest
restart: on-failure
environment:
ZOOKEEPER_CLIENT_PORT: 2181
logging:
driver: none

kafka:
image: confluentinc/cp-kafka:latest
restart: on-failure
logging:
driver: none
depends_on:
- zookeeper
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
7 changes: 7 additions & 0 deletions _examples/simple-app/publishing-app/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module main.go

require (
github.com/ThreeDotsLabs/watermill v0.1.2 // indirect
github.com/google/uuid v1.1.0 // indirect
github.com/renstrom/shortuuid v3.0.0+incompatible // indirect
)
22 changes: 22 additions & 0 deletions _examples/simple-app/publishing-app/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
github.com/ThreeDotsLabs/watermill v0.1.2 h1:1V1SJNRZ7+KYVDX3cFDQGY2jBlMc+tLY0wqhQfCwozQ=
github.com/ThreeDotsLabs/watermill v0.1.2/go.mod h1:c0DOrvvuqbB8uhZlgY/fukFFfv1WZ6HinSktALd9b38=
github.com/confluentinc/confluent-kafka-go v0.11.6 h1:rEblubnNXCjRThwAGnFSzLKYIRAoXLDC3A9r4ciziHU=
github.com/confluentinc/confluent-kafka-go v0.11.6/go.mod h1:u2zNLny2xq+5rWeTQjFHbDzzNuba4P1vo31r9r4uAdg=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-chi/chi v3.3.3+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s=
github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/renstrom/shortuuid v3.0.0+incompatible h1:F6T1U7bWlI3FTV+JE8HyeR7bkTeYZJntqQLA9ST4HOQ=
github.com/renstrom/shortuuid v3.0.0+incompatible/go.mod h1:n18Ycpn8DijG+h/lLBQVnGKv1BCtTeXo8KKSbBOrQ8c=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
53 changes: 29 additions & 24 deletions _examples/simple-app/publishing-app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"encoding/json"
"fmt"
"log"
"math/rand"
"time"
Expand All @@ -15,34 +14,20 @@ import (
"github.com/renstrom/shortuuid"
)

type postAdded struct {
OccurredOn time.Time `json:"occurred_on"`

Author string `json:"author"`
Title string `json:"title"`

Content string `json:"content"`
}

var letters = []rune("abcdefghijklmnopqrstuvwxyz")

// randString generates random string of len n
func randString(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}
var (
brokers = []string{"kafka:9092"}
)

func main() {
publisher, err := kafka.NewPublisher([]string{"localhost:9092"}, kafka.DefaultMarshaler{}, nil)
log.Println("Starting publishing app")

publisher, err := kafka.NewPublisher(brokers, kafka.DefaultMarshaler{}, nil)
if err != nil {
panic(err)
}
defer publisher.Close()

messagesToAdd := 1000
messagesToAdd := 10000
workers := 25

msgAdded := make(chan struct{})
Expand All @@ -52,8 +37,8 @@ func main() {
for range msgAdded {
messagesToAdd--

if messagesToAdd%100000 == 0 {
fmt.Println("left ", messagesToAdd)
if messagesToAdd%1000 == 0 {
log.Println("left ", messagesToAdd)
}
if messagesToAdd == 0 {
allMessagesAdded <- struct{}{}
Expand Down Expand Up @@ -95,3 +80,23 @@ func main() {
// waiting to all being produced
<-allMessagesAdded
}

type postAdded struct {
OccurredOn time.Time `json:"occurred_on"`

Author string `json:"author"`
Title string `json:"title"`

Content string `json:"content"`
}

var letters = []rune("abcdefghijklmnopqrstuvwxyz")

// randString generates random string of len n
func randString(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}
52 changes: 0 additions & 52 deletions _examples/simple-app/subscribing-app/counter.go

This file was deleted.

44 changes: 0 additions & 44 deletions _examples/simple-app/subscribing-app/feed_updater.go

This file was deleted.

7 changes: 7 additions & 0 deletions _examples/simple-app/subscribing-app/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module main.go

require (
github.com/ThreeDotsLabs/watermill v0.1.2 // indirect
github.com/deathowl/go-metrics-prometheus v0.0.0-20181105123824-7cfe975c505b // indirect
github.com/prometheus/client_golang v0.9.2 // indirect
)
36 changes: 36 additions & 0 deletions _examples/simple-app/subscribing-app/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
github.com/ThreeDotsLabs/watermill v0.1.2 h1:1V1SJNRZ7+KYVDX3cFDQGY2jBlMc+tLY0wqhQfCwozQ=
github.com/ThreeDotsLabs/watermill v0.1.2/go.mod h1:c0DOrvvuqbB8uhZlgY/fukFFfv1WZ6HinSktALd9b38=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/confluentinc/confluent-kafka-go v0.11.6 h1:rEblubnNXCjRThwAGnFSzLKYIRAoXLDC3A9r4ciziHU=
github.com/confluentinc/confluent-kafka-go v0.11.6/go.mod h1:u2zNLny2xq+5rWeTQjFHbDzzNuba4P1vo31r9r4uAdg=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deathowl/go-metrics-prometheus v0.0.0-20181105123824-7cfe975c505b h1:9dj08d9Flaexn3poWqgmV2/LRRhz4rbTMrL6eTGDOAM=
github.com/deathowl/go-metrics-prometheus v0.0.0-20181105123824-7cfe975c505b/go.mod h1:HyiO0WRMVDmaYgeKx/frAiip/fVpUwteTT/RkjwiA0Q=
github.com/go-chi/chi v3.3.3+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Loading

0 comments on commit cfdafe8

Please sign in to comment.