Skip to content

Commit c92835c

Browse files
authored
Merge pull request #3 from Gerfey/v0.8.0
RELEASE v0.8.0
2 parents 95f841b + bca9d06 commit c92835c

File tree

91 files changed

+3181
-1212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3181
-1212
lines changed

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@
77
[![Go Reference](https://pkg.go.dev/badge/github.com/Gerfey/messenger.svg)](https://pkg.go.dev/github.com/Gerfey/messenger)
88
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
99

10-
> ⚠️ `v0.7.0` is a pre-release version — feel free to test and report issues!
10+
> `v0.8.0` is a pre-release version — feel free to test and report issues!
1111
12-
> 📚 Full documentation available in the [GitHub Wiki](https://github.com/Gerfey/messenger/wiki/Documentation)
12+
> Full documentation available in the [GitHub Wiki](https://github.com/Gerfey/messenger/wiki/Documentation)
1313
1414
🇷🇺 [Русская версия](README.ru.md)
1515

16-
## Features
17-
- **Multiple Transports**: AMQP (RabbitMQ), In-Memory (sync)
16+
## Features
17+
- **Multiple Transports**: AMQP (RabbitMQ), Kafka, Redis (Stream), In-Memory (sync)
1818
- **Middleware Chain**: Extensible middleware system for message processing
1919
- **Event-Driven**: Built-in event dispatcher for lifecycle hooks
2020
- **Retry Mechanism**: Configurable retry strategies with exponential backoff
2121
- **Message Routing**: Flexible routing system for message distribution
2222
- **Stamps System**: Metadata attachment for message tracking
2323
- **YAML Configuration**: Easy configuration management with `%env(...)%` support
2424

25-
## 📦 Installation
25+
## Installation
2626
> Requires Go 1.24+
2727
```bash
28-
go get github.com/gerfey/messenger@v0.7.0
28+
go get github.com/gerfey/messenger@v0.8.0
2929
```
3030

31-
## 🚀 Quick Start
31+
## Quick Start
3232

3333
### Define Your Message
3434

@@ -83,33 +83,40 @@ bus, _ := m.GetDefaultBus()
8383
_, _ = bus.Dispatch(ctx, &HelloMessage{Text: "World"})
8484
```
8585
86-
## 🔍 More Examples
86+
## More Examples
8787
88-
* Commands with void return
89-
* Queries with return value access
90-
* Retry and Dead Letter Queue
91-
* Custom Middleware and Transports
92-
* Event Listeners and Lifecycle Hooks
88+
* Commands with void return
89+
* Queries with return value access
90+
* Retry and Dead Letter Queue
91+
* Custom Middleware and Transports
92+
* Event Listeners and Lifecycle Hooks
9393
9494
> See [Usage Scenarios](https://github.com/Gerfey/messenger/wiki/Usage-Scenarios) for commands, queries, return values and advanced use-cases.
9595
96-
## 🤝 Contributing
96+
## Benchmark
97+
98+
- AMQP (RabbitMQ): [AMQP Transport Benchmark Report](docs/benchmark/AMQP-Benchmark.md)
99+
- Redis (Stream): [Redis Transport Benchmark Report](docs/benchmark/Redis-Benchmark.md)
100+
- Sync: [Sync Transport Benchmark Report](docs/benchmark/Sync-Benchmark.md)
101+
- Kafka (Async): [Kafka Transport Async Benchmark Report](docs/benchmark/Kafka-async-Benchmark.md)
102+
103+
## Contributing
97104
98105
1. Fork the repository
99106
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
100107
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
101108
4. Push to the branch (`git push origin feature/amazing-feature`)
102109
5. Open a Pull Request
103110

104-
## ⚖️ License
111+
## License
105112

106113
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
107114

108-
## ⭐️ Support
115+
## Support
109116

110117
If you find this project useful, please consider starring ⭐️ it and sharing with others!
111118

112-
## 🙏 Acknowledgments
119+
## Acknowledgments
113120

114121
- Inspired by [Symfony Messenger](https://symfony.com/doc/current/messenger.html)
115122
- Built with ❤️ for the Go community

README.ru.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@
77
[![Go Reference](https://pkg.go.dev/badge/github.com/Gerfey/messenger.svg)](https://pkg.go.dev/github.com/Gerfey/messenger)
88
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
99

10-
> ⚠️ Версия `v0.7.0` — это пре-релиз. Тестируйте и сообщайте о багах!
10+
> Версия `v0.8.0` — это пре-релиз. Тестируйте и сообщайте о багах!
1111
12-
> 📚 Полная документация доступна на [GitHub Wiki](https://github.com/Gerfey/messenger/wiki/Documentation)
12+
> Полная документация доступна на [GitHub Wiki](https://github.com/Gerfey/messenger/wiki/Documentation)
1313
1414
🇬🇧 [English README](README.md)
1515

1616
---
1717

18-
## Возможности
19-
- **Множественные транспорты**: AMQP (RabbitMQ), In-Memory (`sync`)
18+
## Возможности
19+
- **Множественные транспорты**: AMQP (RabbitMQ), Kafka, Redis (Stream), In-Memory (sync)
2020
- **Цепочка middleware**: Расширяемая система промежуточной обработки
2121
- **Событийный движок**: Встроенный dispatcher событий жизненного цикла
2222
- **Механизм повторов**: Настраиваемые стратегии ретраев с поддержкой DLQ
2323
- **Маршрутизация сообщений**: Гибкое сопоставление сообщений и транспортов
2424
- **Система метаданных (Stamps)**: Для трассировки и поведения сообщений
2525
- **YAML-конфигурация**: С поддержкой переменных окружения `%env(...)%`
2626

27-
## 📦 Установка
27+
## Установка
2828
> Требуется Go версии **1.24+**
2929
```bash
30-
go get github.com/gerfey/messenger@v0.7.0
30+
go get github.com/gerfey/messenger@v0.8.0
3131
```
3232

33-
## 🚀 Быстрый старт
33+
## Быстрый старт
3434

3535
### Определите сообщение
3636

@@ -85,33 +85,40 @@ bus, _ := m.GetDefaultBus()
8585
_, _ = bus.Dispatch(ctx, &HelloMessage{Text: "World"})
8686
```
8787
88-
## 🔍 Больше примеров
88+
## Больше примеров
8989
90-
* Команды без возврата значения
91-
* Запросы с возвратом результата
92-
* Повторные попытки и Dead Letter Queue
93-
* Пользовательские middleware и транспорты
94-
* Слушатели событий и хуки жизненного цикла
90+
* Команды без возврата значения
91+
* Запросы с возвратом результата
92+
* Повторные попытки и Dead Letter Queue
93+
* Пользовательские middleware и транспорты
94+
* Слушатели событий и хуки жизненного цикла
9595
9696
> Смотри [Сценарии использования](https://github.com/Gerfey/messenger/wiki/Сценарии-использования).
9797
98-
## 🤝 Как внести вклад
98+
## Показатели
99+
100+
- AMQP (RabbitMQ): [AMQP Transport Benchmark Report](docs/benchmark/AMQP-Benchmark.md)
101+
- Redis (Stream): [Redis Transport Benchmark Report](docs/benchmark/Redis-Benchmark.md)
102+
- Sync: [Sync Transport Benchmark Report](docs/benchmark/Sync-Benchmark.md)
103+
- Kafka (Async): [Kafka Transport Async Benchmark Report](docs/benchmark/Kafka-async-Benchmark.md)
104+
105+
## Как внести вклад
99106
100107
1. Форкните репозиторий
101108
2. Создайте новую ветку (`git checkout -b feature/amazing-feature`)
102109
3. Сделайте коммит (`git commit -m 'Add some amazing feature'`)
103110
4. Запушьте изменения (`git push origin feature/amazing-feature`)
104111
5. Откройте Pull Request
105112

106-
## ⚖️ Лицензия
113+
## Лицензия
107114

108115
Проект лицензирован под [MIT](LICENSE).
109116

110-
## ⭐️ Поддержка
117+
## Поддержка
111118

112119
Если вам полезен этот проект — поставьте ⭐️ и расскажите другим!
113120

114-
## 🙏 Благодарности
121+
## Благодарности
115122

116123
- Вдохновлено [Symfony Messenger](https://symfony.com/doc/current/messenger.html)
117124
- Сделано с ❤️ для сообщества Go

api/builder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type Builder interface {
66
RegisterStamp(any)
77
RegisterListener(any, any)
88
RegisterMiddleware(string, Middleware)
9+
RegisterSerializer(string, Serializer)
910
RegisterTransportFactory(TransportFactory)
1011
Build() (Messenger, error)
1112
}

api/serializer.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ type Serializer interface {
44
Marshal(Envelope) ([]byte, map[string]string, error)
55
Unmarshal(body []byte, headers map[string]string) (Envelope, error)
66
}
7+
8+
type SerializerLocator interface {
9+
Register(string, Serializer)
10+
GetAll() []Serializer
11+
Get(name string) (Serializer, error)
12+
}

api/transport.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ package api
33
import (
44
"context"
55
"reflect"
6-
7-
"github.com/gerfey/messenger/config"
86
)
97

108
type Transport interface {
119
Sender
1210
Receiver
11+
Closer
1312
}
1413

1514
type Sender interface {
@@ -21,11 +20,30 @@ type Receiver interface {
2120
Receive(context.Context, func(context.Context, Envelope) error) error
2221
}
2322

23+
type Closer interface {
24+
Close() error
25+
}
26+
27+
type Producer interface {
28+
Send(context.Context, Envelope) error
29+
Close() error
30+
}
31+
32+
type Consumer interface {
33+
Consume(context.Context, func(context.Context, Envelope) error) error
34+
Close() error
35+
}
36+
2437
type RetryableTransport interface {
2538
Transport
2639
Retry(context.Context, Envelope) error
2740
}
2841

42+
type SetupableTransport interface {
43+
Transport
44+
Setup(ctx context.Context) error
45+
}
46+
2947
type SenderLocator interface {
3048
Register(string, Sender) error
3149
GetSenders(Envelope) []Sender
@@ -35,7 +53,7 @@ type SenderLocator interface {
3553

3654
type TransportFactory interface {
3755
Supports(string) bool
38-
Create(string, string, config.OptionsConfig) (Transport, error)
56+
Create(string, string, []byte, Serializer) (Transport, error)
3957
}
4058

4159
type RoutedMessage interface {

0 commit comments

Comments
 (0)