Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding and fixing documentation issues #98

Merged
merged 3 commits into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ A lightweight transactional message bus on top of RabbitMQ supporting:
4) Publisher confirms
5) [Reliable messaging](https://github.com/wework/grabbit/blob/master/docs/OUTBOX.md) and local service transactivity via Transaction Outbox pattern
6) Deadlettering
7) [Structured logging](https://github.com/wework/grabbit/blob/master/docs/LOGGING.md)

Planned:

1) Deduplication of inbound messages

## Stable release
the v1.x branch contains the latest stable releases of grabbit and one should track that branch to get point and minor release updates.
the v1.x branch contains the latest stable releases of grabbit and one should track that branch to get point and minor release updates.

## Supported transactional resources
1) MySql > 8.0 (InnoDB)
Expand Down Expand Up @@ -78,8 +79,8 @@ Register a command handler
```Go


handler := func(invocation gbus.Invocation, message *gbus.BusMessage) error
cmd, ok := message.Payload.(SomeCommand)
handler := func(invocation gbus.Invocation, message *gbus.BusMessage) error{
cmd, ok := message.Payload.(*SomeCommand)
if ok {
fmt.Printf("handler invoked with message %v", cmd)
return nil
Expand All @@ -96,7 +97,7 @@ Register an event handler


eventHandler := func(invocation gbus.Invocation, message *gbus.BusMessage) {
evt, ok := message.Payload.(SomeEvent)
evt, ok := message.Payload.(*SomeEvent)
if ok {
fmt.Printf("handler invoked with event %v", evt)
return nil
Expand Down
22 changes: 22 additions & 0 deletions docs/LOGGING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Logging

grabbit supports structured logging via the [logrus](https://github.com/sirupsen/logrus) logging package.
The logger is accessible to message handlers via the past in invocation instance.

```go

func SomeHandler(invocation gbus.Invocation, message *gbus.BusMessage) error{
invocation.Log().WithField("name", "rhinof").Info("handler invoked")
return nil
}

```

grabbit will create a default instance of logrus FieldLogger if no such logger is set when the bus is created.
In order to set a custom logger when creating the bus you need to call the Builder.WithLogger method passing it
a logrus.FieldLogger instance.

```go


```