diff --git a/docs/content/docs/cqrs.md b/docs/content/docs/cqrs.md index 7531594b5..cafe5fff9 100644 --- a/docs/content/docs/cqrs.md +++ b/docs/content/docs/cqrs.md @@ -27,19 +27,19 @@ The command is a simple data structure, representing the request for executing s #### Command Bus {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/cqrs/command_bus.go" first_line_contains="// CommandBus" last_line_contains="type CommandBus" padding_after="0" %}} +{{% load-snippet-partial file="src-link/components/cqrs/command_bus.go" first_line_contains="// CommandBus" last_line_contains="type CommandBus" padding_after="0" %}} {{% /render-md %}} #### Command Processor {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/cqrs/command_processor.go" first_line_contains="// CommandProcessor" last_line_contains="type CommandProcessor" padding_after="0" %}} +{{% load-snippet-partial file="src-link/components/cqrs/command_processor.go" first_line_contains="// CommandProcessor" last_line_contains="type CommandProcessor" padding_after="0" %}} {{% /render-md %}} #### Command Handler {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/cqrs/command_processor.go" first_line_contains="// CommandHandler" last_line_contains="type CommandHandler" padding_after="0" %}} +{{% load-snippet-partial file="src-link/components/cqrs/command_processor.go" first_line_contains="// CommandHandler" last_line_contains="type CommandHandler" padding_after="0" %}} {{% /render-md %}} #### Event @@ -49,31 +49,31 @@ The event represents something that already took place. Events are immutable. #### Event Bus {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/cqrs/event_bus.go" first_line_contains="// EventBus" last_line_contains="type EventBus" padding_after="0" %}} +{{% load-snippet-partial file="src-link/components/cqrs/event_bus.go" first_line_contains="// EventBus" last_line_contains="type EventBus" padding_after="0" %}} {{% /render-md %}} #### Event Processor {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/cqrs/event_processor.go" first_line_contains="// EventProcessor" last_line_contains="type EventProcessor" padding_after="0" %}} +{{% load-snippet-partial file="src-link/components/cqrs/event_processor.go" first_line_contains="// EventProcessor" last_line_contains="type EventProcessor" padding_after="0" %}} {{% /render-md %}} #### Event Handler {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/cqrs/event_processor.go" first_line_contains="// EventHandler" last_line_contains="type EventHandler" padding_after="0" %}} +{{% load-snippet-partial file="src-link/components/cqrs/event_processor.go" first_line_contains="// EventHandler" last_line_contains="type EventHandler" padding_after="0" %}} {{% /render-md %}} #### CQRS Facade {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/cqrs/cqrs.go" first_line_contains="// Facade" last_line_contains="type Facade" padding_after="0" %}} +{{% load-snippet-partial file="src-link/components/cqrs/cqrs.go" first_line_contains="// Facade" last_line_contains="type Facade" padding_after="0" %}} {{% /render-md %}} #### Command and Event Marshaler {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/cqrs/marshaler.go" first_line_contains="// CommandEventMarshaler" last_line_contains="NameFromMessage(" padding_after="1" %}} +{{% load-snippet-partial file="src-link/components/cqrs/marshaler.go" first_line_contains="// CommandEventMarshaler" last_line_contains="NameFromMessage(" padding_after="1" %}} {{% /render-md %}} ## Usage @@ -107,7 +107,7 @@ The domain is simple: For the beginning, we need to simulate the guest's action. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="bookRoomCmd := &BookRoom{" last_line_contains="panic(err)" padding_after="1" %}} +{{% load-snippet-partial file="src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="bookRoomCmd := &BookRoom{" last_line_contains="panic(err)" padding_after="1" %}} {{% /render-md %}} ### Command handler @@ -115,7 +115,7 @@ For the beginning, we need to simulate the guest's action. `BookRoomHandler` will handle our command. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="// BookRoomHandler is a command handler" last_line_contains="// OrderBeerOnRoomBooked is a event handler" padding_after="0" %}} +{{% load-snippet-partial file="src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="// BookRoomHandler is a command handler" last_line_contains="// OrderBeerOnRoomBooked is a event handler" padding_after="0" %}} {{% /render-md %}} ### Event handler @@ -123,7 +123,7 @@ For the beginning, we need to simulate the guest's action. As mentioned before, we want to order a beer every time when a room is booked (*"Whenever a Room is booked"* post-it). We do it by using the `OrderBeer` command. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="// OrderBeerOnRoomBooked is a event handler" last_line_contains="// OrderBeerHandler is a command handler" padding_after="0" %}} +{{% load-snippet-partial file="src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="// OrderBeerOnRoomBooked is a event handler" last_line_contains="// OrderBeerHandler is a command handler" padding_after="0" %}} {{% /render-md %}} `OrderBeerHandler` is very similar to `BookRoomHandler`. The only difference is, that it sometimes returns an error when there are not enough beers, which causes redelivery of the command. @@ -132,7 +132,7 @@ You can find the entire implementation in the [example source code](https://gith ### Building a read model with the event handler {{% render-md %}} -{{% load-snippet-partial file="content/src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="// BookingsFinancialReport is a read model" last_line_contains="func main() {" padding_after="0" %}} +{{% load-snippet-partial file="src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="// BookingsFinancialReport is a read model" last_line_contains="func main() {" padding_after="0" %}} {{% /render-md %}} ### Wiring it up - the CQRS facade @@ -148,7 +148,7 @@ Let's go back to the CQRS. As you already know, CQRS is built from multiple comp To simplify creating all these building blocks, we created `cqrs.Facade`, which creates all of them. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="main() {" last_line_contains="err := router.Run(" padding_after="3" %}} +{{% load-snippet-partial file="src-link/_examples/basic/5-cqrs-protobuf/main.go" first_line_contains="main() {" last_line_contains="err := router.Run(" padding_after="3" %}} {{% /render-md %}} And that's all. We have a working CQRS application. diff --git a/docs/content/docs/getting-started.md b/docs/content/docs/getting-started.md index 652356d14..62920d42e 100644 --- a/docs/content/docs/getting-started.md +++ b/docs/content/docs/getting-started.md @@ -312,7 +312,7 @@ The second option is useful when your handler requires some dependencies like da You can run this example by `go run main.go`. -You've just created your first application with Watermill. You can find the full source in [/docs/src-link/_examples/basic/3-router/main.go](https://github.com/ThreeDotsLabs/watermill/blob/master/docs/src-link/_examples/basic/3-router/main.go). +You've just created your first application with Watermill. You can find the full source in [/_examples/basic/3-router/main.go](https://github.com/ThreeDotsLabs/watermill/blob/master/_examples/basic/3-router/main.go). ### Logging @@ -337,7 +337,7 @@ For more detailed documentation check [documentation topics]({{< ref "/docs" >}} Check out the [examples](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples) that will show you how to start using Watermill. -The recommended entry point is [Your first Watermill application](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/basic/1-your-first-app). +The recommended entry point is [Your first Watermill application](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/basic/1-your-first-app). It contains the entire environment in `docker-compose.yml`, including Golang and Kafka, which you can run with one command. After that, you can see the [Realtime feed](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/basic/2-realtime-feed) example. diff --git a/docs/content/docs/message.md b/docs/content/docs/message.md index 66d54320e..46b38353f 100644 --- a/docs/content/docs/message.md +++ b/docs/content/docs/message.md @@ -16,7 +16,7 @@ When a message is processed, you should send an [`Ack()`]({{< ref "#ack" >}}) or `Acks` and `Nacks` are processed by Subscribers (in default implementations, the subscribers are waiting for an `Ack` or a `Nack`). {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/message.go" first_line_contains="type Message struct {" last_line_contains="ctx context.Context" padding_after="2" %}} +{{% load-snippet-partial file="src-link/message/message.go" first_line_contains="type Message struct {" last_line_contains="ctx context.Context" padding_after="2" %}} {{% /render-md %}} ### Ack @@ -24,20 +24,20 @@ When a message is processed, you should send an [`Ack()`]({{< ref "#ack" >}}) or #### Sending `Ack` {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/message.go" first_line_contains="// Ack" last_line_contains="func (m *Message) Ack() bool {" padding_after="0" %}} +{{% load-snippet-partial file="src-link/message/message.go" first_line_contains="// Ack" last_line_contains="func (m *Message) Ack() bool {" padding_after="0" %}} {{% /render-md %}} ### Nack {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/message.go" first_line_contains="// Nack" last_line_contains="func (m *Message) Nack() bool {" padding_after="0" %}} +{{% load-snippet-partial file="src-link/message/message.go" first_line_contains="// Nack" last_line_contains="func (m *Message) Nack() bool {" padding_after="0" %}} {{% /render-md %}} ### Receiving `Ack/Nack` {{% render-md %}} -{{% load-snippet-partial file="content/docs/message/receiving-ack.go" first_line_contains="select {" last_line_contains="}" padding_after="0" %}} +{{% load-snippet-partial file="docs/message/receiving-ack.go" first_line_contains="select {" last_line_contains="}" padding_after="0" %}} {{% /render-md %}} @@ -46,6 +46,6 @@ When a message is processed, you should send an [`Ack()`]({{< ref "#ack" >}}) or Message contains the standard library context, just like an HTTP request. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/message.go" first_line_contains="// Context" last_line_contains="func (m *Message) SetContext" padding_after="2" %}} +{{% load-snippet-partial file="src-link/message/message.go" first_line_contains="// Context" last_line_contains="func (m *Message) SetContext" padding_after="2" %}} {{% /render-md %}} diff --git a/docs/content/docs/messages-router.md b/docs/content/docs/messages-router.md index 741e3591d..38bc2d0eb 100644 --- a/docs/content/docs/messages-router.md +++ b/docs/content/docs/messages-router.md @@ -20,7 +20,7 @@ To handle these requirements, there is a component named **Router**. ### Configuration {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="type RouterConfig struct {" last_line_contains="RouterConfig) Validate()" padding_after="2" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="type RouterConfig struct {" last_line_contains="RouterConfig) Validate()" padding_after="2" %}} {{% /render-md %}} ### Handler @@ -28,13 +28,13 @@ To handle these requirements, there is a component named **Router**. At the beginning you need to implement `HandlerFunc`: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="// HandlerFunc is" last_line_contains="type HandlerFunc func" padding_after="1" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="// HandlerFunc is" last_line_contains="type HandlerFunc func" padding_after="1" %}} {{% /render-md %}} Next, you have to add a new handler with `Router.AddHandler`: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="// AddHandler" last_line_contains=") {" padding_after="0" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="// AddHandler" last_line_contains=") {" padding_after="0" %}} {{% /render-md %}} See an example usage from [Getting Started]({{< ref "/docs/getting-started#using-messages-router" >}}): @@ -47,7 +47,7 @@ See an example usage from [Getting Started]({{< ref "/docs/getting-started#using Not every handler will produce new messages. You can add this kind of handler by using `Router.AddNoPublisherHandler`: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="// AddNoPublisherHandler" last_line_contains=") {" padding_after="0" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="// AddNoPublisherHandler" last_line_contains=") {" padding_after="0" %}} {{% /render-md %}} ### Ack @@ -66,7 +66,7 @@ If it is an issue, consider publishing just one message with each handler. To run the Router, you need to call `Run()`. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="// Run" last_line_contains="func (r *Router) Run(ctx context.Context) (err error) {" padding_after="0" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="// Run" last_line_contains="func (r *Router) Run(ctx context.Context) (err error) {" padding_after="0" %}} {{% /render-md %}} #### Ensuring that the Router is running @@ -74,7 +74,7 @@ To run the Router, you need to call `Run()`. It can be useful to know if the router is running. You can use the `Running()` method for this. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="// Running" last_line_contains="func (r *Router) Running()" padding_after="0" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="// Running" last_line_contains="func (r *Router) Running()" padding_after="0" %}} {{% /render-md %}} ### Execution models @@ -92,7 +92,7 @@ See the chosen Pub/Sub documentation for supported execution models. ### Middleware {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="// HandlerMiddleware" last_line_contains="type HandlerMiddleware" padding_after="1" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="// HandlerMiddleware" last_line_contains="type HandlerMiddleware" padding_after="1" %}} {{% /render-md %}} A full list of standard middlewares can be found in [Middlewares]({{< ref "/docs/middlewares" >}}). @@ -100,7 +100,7 @@ A full list of standard middlewares can be found in [Middlewares]({{< ref "/docs ### Plugin {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="// RouterPlugin" last_line_contains="type RouterPlugin" padding_after="1" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="// RouterPlugin" last_line_contains="type RouterPlugin" padding_after="1" %}} {{% /render-md %}} A full list of standard plugins can be found in [message/router/plugin](https://github.com/ThreeDotsLabs/watermill/tree/master/message/router/plugin). diff --git a/docs/content/docs/metrics.md b/docs/content/docs/metrics.md index 023533295..633acd65e 100644 --- a/docs/content/docs/metrics.md +++ b/docs/content/docs/metrics.md @@ -16,7 +16,7 @@ We provide a default implementation using Prometheus, based on the official [Pro The `components/metrics` package exports `PrometheusMetricsBuilder`, which provides convenience functions to wrap publishers, subscribers and handlers so that they update the relevant Prometheus registry: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/metrics/builder.go" first_line_contains="// PrometheusMetricsBuilder" last_line_contains="func (b PrometheusMetricsBuilder)" %}} +{{% load-snippet-partial file="src-link/components/metrics/builder.go" first_line_contains="// PrometheusMetricsBuilder" last_line_contains="func (b PrometheusMetricsBuilder)" %}} {{% /render-md %}} ### Wrapping publishers, subscribers and handlers @@ -24,13 +24,13 @@ The `components/metrics` package exports `PrometheusMetricsBuilder`, which provi If you are using Watermill's [router](/docs/messages-router) (which is recommended in most cases), you can use a single convenience function `AddPrometheusRouterMetrics` to ensure that all the handlers added to this router are wrapped to update the Prometheus registry, together with their publishers and subscribers: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/metrics/builder.go" first_line_contains="// AddPrometheusRouterMetrics" last_line_contains="AddMiddleware" padding_after="1" %}} +{{% load-snippet-partial file="src-link/components/metrics/builder.go" first_line_contains="// AddPrometheusRouterMetrics" last_line_contains="AddMiddleware" padding_after="1" %}} {{% /render-md %}} Example use of `AddPrometheusRouterMetrics`: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/_examples/basic/4-metrics/main.go" first_line_contains="// we leave the namespace" last_line_contains="metricsBuilder.AddPrometheusRouterMetrics" %}} +{{% load-snippet-partial file="src-link/_examples/basic/4-metrics/main.go" first_line_contains="// we leave the namespace" last_line_contains="metricsBuilder.AddPrometheusRouterMetrics" %}} {{% /render-md %}} In the snippet above, we have left the `namespace` and `subsystem` arguments empty. The Prometheus client library [uses these](https://godoc.org/github.com/prometheus/client_golang/prometheus#BuildFQName) to prefix the metric names. You may want to use namespace or subsystem, but be aware that this will impact the metric names and you will have to adjust the Grafana dashboard accordingly. @@ -38,7 +38,7 @@ In the snippet above, we have left the `namespace` and `subsystem` arguments emp Standalone publishers and subscribers may also be decorated through the use of dedicated methods of `PrometheusMetricBuilder`: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/_examples/basic/4-metrics/main.go" first_line_contains="subWithMetrics, err := " last_line_contains="pubWithMetrics, err := " padding_after="3" %}} +{{% load-snippet-partial file="src-link/_examples/basic/4-metrics/main.go" first_line_contains="subWithMetrics, err := " last_line_contains="pubWithMetrics, err := " padding_after="3" %}} {{% /render-md %}} ### Exposing the /metrics endpoint @@ -48,13 +48,13 @@ In accordance with how Prometheus works, the service needs to expose a HTTP endp To serve this endpoint, there are two convenience functions, one using a previously created Prometheus Registry, while the other also creates a new registry: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/components/metrics/http.go" first_line_contains="// CreateRegistryAndServeHTTP" last_line_contains="func ServeHTTP(" %}} +{{% load-snippet-partial file="src-link/components/metrics/http.go" first_line_contains="// CreateRegistryAndServeHTTP" last_line_contains="func ServeHTTP(" %}} {{% /render-md %}} Here is an example of its use in practice: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/_examples/basic/4-metrics/main.go" first_line_contains="prometheusRegistry, closeMetricsServer :=" last_line_contains="metricsBuilder.AddPrometheusRouterMetrics" %}} +{{% load-snippet-partial file="src-link/_examples/basic/4-metrics/main.go" first_line_contains="prometheusRegistry, closeMetricsServer :=" last_line_contains="metricsBuilder.AddPrometheusRouterMetrics" %}} {{% /render-md %}} ### Example application @@ -142,7 +142,7 @@ If you feel like some metric is missing, you can easily expand this basic implem An elegant way to update these metrics would be through the use of decorators: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/decorator.go" first_line_contains="// MessageTransformSubscriberDecorator" last_line_contains="type messageTransformSubscriberDecorator" %}} +{{% load-snippet-partial file="src-link/message/decorator.go" first_line_contains="// MessageTransformSubscriberDecorator" last_line_contains="type messageTransformSubscriberDecorator" %}} {{% /render-md %}} and/or [router middlewares](/docs/messages-router/#middleware). diff --git a/docs/content/docs/middlewares.md b/docs/content/docs/middlewares.md index efded11b2..7b884c01e 100644 --- a/docs/content/docs/middlewares.md +++ b/docs/content/docs/middlewares.md @@ -18,7 +18,7 @@ and capturing the stacktrace. Middlewares wrap the handler function like this: {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/router.go" first_line_contains="// HandlerMiddleware" last_line_contains="type HandlerMiddleware" %}} +{{% load-snippet-partial file="src-link/message/router.go" first_line_contains="// HandlerMiddleware" last_line_contains="type HandlerMiddleware" %}} {{% /render-md %}} ## Available middlewares diff --git a/docs/content/docs/pub-sub-implementing.md b/docs/content/docs/pub-sub-implementing.md index e2c21e389..0f9e654bb 100644 --- a/docs/content/docs/pub-sub-implementing.md +++ b/docs/content/docs/pub-sub-implementing.md @@ -13,7 +13,7 @@ toc = true To add support for a custom Pub/Sub, you have to implement both `message.Publisher` and `message.Subscriber` interfaces. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/pubsub.go" first_line_contains="type Publisher interface" last_line_contains="type SubscribeInitializer" padding_after="0" %}} +{{% load-snippet-partial file="src-link/message/pubsub.go" first_line_contains="type Publisher interface" last_line_contains="type SubscribeInitializer" padding_after="0" %}} {{% /render-md %}} ### TODO list diff --git a/docs/content/docs/pub-sub.md b/docs/content/docs/pub-sub.md index f35a9a450..664bf7cc4 100644 --- a/docs/content/docs/pub-sub.md +++ b/docs/content/docs/pub-sub.md @@ -11,7 +11,7 @@ toc = true ### Publisher {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/pubsub.go" first_line_contains="Publisher interface {" last_line_contains="Close() error" padding_after="1" %}} +{{% load-snippet-partial file="src-link/message/pubsub.go" first_line_contains="Publisher interface {" last_line_contains="Close() error" padding_after="1" %}} {{% /render-md %}} #### Publishing multiple messages @@ -31,7 +31,7 @@ Publish can be synchronous or asynchronous - it depends on the implementation. ### Subscriber {{% render-md %}} -{{% load-snippet-partial file="content/src-link/message/pubsub.go" first_line_contains="Subscriber interface {" last_line_contains="Close() error" padding_after="1" %}} +{{% load-snippet-partial file="src-link/message/pubsub.go" first_line_contains="Subscriber interface {" last_line_contains="Close() error" padding_after="1" %}} {{% /render-md %}} #### Ack/Nack mechanism diff --git a/docs/content/pubsubs/amqp.md b/docs/content/pubsubs/amqp.md index cb070af02..7ba724ce5 100644 --- a/docs/content/pubsubs/amqp.md +++ b/docs/content/pubsubs/amqp.md @@ -79,7 +79,7 @@ If you need to customize thing in `amqp.Delivery`, you can do it `PostprocessPub AMQP doesn't provide mechanism like Kafka's "consumer groups". You can still achieve similar behaviour with `GenerateQueueNameTopicNameWithSuffix` and `NewDurablePubSubConfig`. {{% render-md %}} -{{% load-snippet-partial file="content/docs/snippets/amqp-consumer-groups/main.go" first_line_contains="func createSubscriber(" last_line_contains="go process(\"subscriber_2\", messages2)" %}} +{{% load-snippet-partial file="docs/snippets/amqp-consumer-groups/main.go" first_line_contains="func createSubscriber(" last_line_contains="go process(\"subscriber_2\", messages2)" %}} {{% /render-md %}} In this example both `pubSub1` and `pubSub2` will receive some messages independently. diff --git a/docs/content/pubsubs/gochannel.md b/docs/content/pubsubs/gochannel.md index d5665f941..74153d1e7 100644 --- a/docs/content/pubsubs/gochannel.md +++ b/docs/content/pubsubs/gochannel.md @@ -11,7 +11,7 @@ toc = false ### Golang Channel {{% render-md %}} -{{% load-snippet-partial file="content/src-link/pubsub/gochannel/pubsub.go" first_line_contains="// GoChannel" last_line_contains="type GoChannel struct {" %}} +{{% load-snippet-partial file="src-link/pubsub/gochannel/pubsub.go" first_line_contains="// GoChannel" last_line_contains="type GoChannel struct {" %}} {{% /render-md %}} #### Characteristics @@ -28,19 +28,19 @@ toc = false You can inject configuration via the constructor. {{% render-md %}} -{{% load-snippet-partial file="content/src-link/pubsub/gochannel/pubsub.go" first_line_contains="func NewGoChannel" last_line_contains="logger:" %}} +{{% load-snippet-partial file="src-link/pubsub/gochannel/pubsub.go" first_line_contains="func NewGoChannel" last_line_contains="logger:" %}} {{% /render-md %}} #### Publishing {{% render-md %}} -{{% load-snippet-partial file="content/src-link/pubsub/gochannel/pubsub.go" first_line_contains="// Publish" last_line_contains="func (g *GoChannel) Publish" %}} +{{% load-snippet-partial file="src-link/pubsub/gochannel/pubsub.go" first_line_contains="// Publish" last_line_contains="func (g *GoChannel) Publish" %}} {{% /render-md %}} #### Subscribing {{% render-md %}} -{{% load-snippet-partial file="content/src-link/pubsub/gochannel/pubsub.go" first_line_contains="// Subscribe" last_line_contains="func (g *GoChannel) Subscribe" %}} +{{% load-snippet-partial file="src-link/pubsub/gochannel/pubsub.go" first_line_contains="// Subscribe" last_line_contains="func (g *GoChannel) Subscribe" %}} {{% /render-md %}} #### Marshaler diff --git a/docs/content/pubsubs/http.md b/docs/content/pubsubs/http.md index 1d87ccd4b..379c593d4 100644 --- a/docs/content/pubsubs/http.md +++ b/docs/content/pubsubs/http.md @@ -11,9 +11,9 @@ toc = false ### HTTP The HTTP subscriber listens to HTTP requests (for example - webhooks) and outputs them as messages. -You can then post them to any Publisher. Here is an example with [sending HTTP messages to Kafka](https://github.com/ThreeDotsLabs/watermill/blob/master/_examples/http-to-kafka/main.go). +You can then post them to any Publisher. Here is an example with [sending HTTP messages to Kafka](https://github.com/ThreeDotsLabs/watermill/blob/master/_examples/real-world-examples/receiving-webhooks/main.go). -The HTTP publisher sends HTTP requests as specified in its configuration. Here is an example with [transforming Kafka messages into HTTP webhook requests](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/kafka-to-http). +The HTTP publisher sends HTTP requests as specified in its configuration. Here is an example with [transforming Kafka messages into HTTP webhook requests](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/real-world-examples/sending-webhooks). #### Characteristics diff --git a/docs/content/pubsubs/io.md b/docs/content/pubsubs/io.md index 66e3f017e..77b68b3c1 100644 --- a/docs/content/pubsubs/io.md +++ b/docs/content/pubsubs/io.md @@ -48,7 +48,7 @@ The reading will continue even if the reads come up empty, but they will not be The continuous reading may be used, for example, to emulate the behaviour of a `tail -f` command, like in this snippet: {{% render-md %}} -{{% load-snippet-partial file="content/docs/snippets/tail-log-file/main.go" first_line_contains="// this will" last_line_contains="return false" padding_after="1" %}} +{{% load-snippet-partial file="docs/snippets/tail-log-file/main.go" first_line_contains="// this will" last_line_contains="return false" padding_after="1" %}} {{% /render-md %}} #### Marshaling/Unmarshaling diff --git a/docs/content/pubsubs/sql.md b/docs/content/pubsubs/sql.md index 358466460..47d9f3a43 100644 --- a/docs/content/pubsubs/sql.md +++ b/docs/content/pubsubs/sql.md @@ -22,7 +22,7 @@ on some kind of message queue. The SQL publisher simply inserts consumed messages into the chosen table. A common approach would be to use it as a persistent log of events that were published on a queue with short message expiration time. -See also the [SQL examples](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/sql). +See also the [SQL example](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/pubsubs/sql). #### Characteristics diff --git a/docs/layouts/shortcodes/load-snippet-partial.html b/docs/layouts/shortcodes/load-snippet-partial.html index 3177e82fc..36a05613a 100644 --- a/docs/layouts/shortcodes/load-snippet-partial.html +++ b/docs/layouts/shortcodes/load-snippet-partial.html @@ -22,10 +22,10 @@ {{ $repo = index (findRE "watermill-[a-z]+" $linkFile) 0 }} {{ $linkFile = replace $linkFile $repo "" }} {{ $linkFile = replace $linkFile "src-link//" "" }} -{{ else if in $file "content/src-link/" }} - {{ $linkFile = replace $linkFile "content/src-link/" "" }} +{{ else if in $linkFile "src-link/" }} + {{ $linkFile = replace $linkFile "src-link/" "" }} {{ else }} - {{ $linkFile = print "docs/" $linkFile }} + {{ $linkFile = print "docs/content/" $linkFile }} {{ end }} {{ $lines := slice }} diff --git a/docs/layouts/shortcodes/load-snippet.html b/docs/layouts/shortcodes/load-snippet.html index 3032f1630..42fd80ba4 100644 --- a/docs/layouts/shortcodes/load-snippet.html +++ b/docs/layouts/shortcodes/load-snippet.html @@ -10,10 +10,16 @@ {{ $lines := slice }} {{ $linkFile := $file }} -{{ if in $file "content/src-link/" }} - {{ $linkFile = replace $linkFile "content/src-link/" "" }} +{{ $repo := "watermill" }} + +{{ if in $file "src-link/watermill-" }} + {{ $repo = index (findRE "watermill-[a-z]+" $linkFile) 0 }} + {{ $linkFile = replace $linkFile $repo "" }} + {{ $linkFile = replace $linkFile "src-link//" "" }} +{{ else if in $linkFile "src-link/" }} + {{ $linkFile = replace $linkFile "src-link/" "" }} {{ else }} - {{ $linkFile = print "docs/" $linkFile }} + {{ $linkFile = print "docs/content/" $linkFile }} {{ end }} Full source: [{{ $linkFile }}](https://github.com/ThreeDotsLabs/watermill/tree/master/{{ $linkFile }})