https://github.com/vfunin/rabbitmq-consumer
Go RabbitMQ consumser
https://github.com/vfunin/rabbitmq-consumer
consumer go mysql postgresql rabbitmq
Last synced: 6 months ago
JSON representation
Go RabbitMQ consumser
- Host: GitHub
- URL: https://github.com/vfunin/rabbitmq-consumer
- Owner: vfunin
- Created: 2022-08-16T06:06:09.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-16T07:32:20.000Z (almost 4 years ago)
- Last Synced: 2024-11-16T03:15:26.843Z (over 1 year ago)
- Topics: consumer, go, mysql, postgresql, rabbitmq
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go RabbitMQ Consumer
---
The application reads messages from the queue and saves them to the database.
#### Supported databases
- [x] PostgreSQL
- [x] MySQL
---
## Building the source
```bash
make build
```
or for build with flags
```bash
make build-flags
```
### Local environment
```bash
make all
```
---
## Using the app
- Create a table in your database:
PostgreSQL:
```postgresql
CREATE TABLE public.messages (
id bigserial PRIMARY KEY,
correlation_id text,
created_at timestamptz default CURRENT_TIMESTAMP,
message text
);
CREATE INDEX messages_correlation_id_index
ON messages (correlation_id);
```
MySQL
```mysql
CREATE TABLE messages
(
id int auto_increment primary key,
correlation_id varchar(255) null,
created_at timestamp default CURRENT_TIMESTAMP not null,
message text null
);
CREATE INDEX messages_correlation_id_index
ON messages (correlation_id);
```
- Change config.yaml
- Run the app:
```bash
./rabbitmq-consumer -config config.yaml
```
---
## Development plan
- [x] Base functionality
- [ ] Add auto reconnect to DB
- [ ] Change structure
- [ ] Add Sentry support
- [ ] Add tests
- [ ] Add optional saving headers and properties