Skip to content

Commit fc97722

Browse files
author
Stephen Asbury
committed
Initial checkin
Code from nats-kafka bridge Ported so things build, some tests run some don't More work todo on performance for ack handling of stan incoming messages
1 parent fa15e64 commit fc97722

Some content is hidden

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

62 files changed

+6598
-2
lines changed

CODE-OF-CONDUCT.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Community Code of Conduct
2+
3+
NATS follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).

GOVERNANCE.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# NATS Server Governance
2+
3+
This repository is part of the NATS project and is subject to the [NATS Governance](https://github.com/nats-io/nats-general/blob/master/GOVERNANCE.md).

MAINTAINERS.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Maintainership
2+
3+
Maintainership is on a per project basis.
4+
5+
## Core-maintainers
6+
7+
- Derek Collison <[email protected]> [@derekcollison](https://github.com/derekcollison)
8+
- Stephen Asbury <[email protected]> [@sasbury](https://github.com/sasbury)
9+
10+
## Maintainers
11+
12+
- Ivan Kozlovic <[email protected]> [@kozlovic](https://github.com/kozlovic)

Makefile

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
build: fmt check compile
3+
4+
fmt:
5+
misspell -locale US .
6+
gofmt -s -w *.go
7+
gofmt -s -w server/conf/*.go
8+
gofmt -s -w server/core/*.go
9+
gofmt -s -w server/logging/*.go
10+
goimports -w *.go
11+
goimports -w server/conf/*.go
12+
goimports -w server/core/*.go
13+
goimports -w server/logging/*.go
14+
15+
check:
16+
go vet ./...
17+
staticcheck ./...
18+
19+
update:
20+
go get -u honnef.co/go/tools/cmd/staticcheck
21+
go get -u github.com/client9/misspell/cmd/misspell
22+
23+
compile:
24+
go build ./...
25+
26+
install: build
27+
go install ./...
28+
29+
cover: test
30+
go tool cover -html=./coverage.out
31+
32+
test: check
33+
rm -rf ./cover.out
34+
@echo "Running tests..."
35+
-go test -race -coverpkg=./... -coverprofile=./coverage.out ./...
36+
37+
failfast:
38+
@echo "Running tests..."
39+
-go test --failfast ./...

README.md

+71-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,71 @@
1-
# nats-replicator
2-
Bridge to replicate NATS Subjects or Channels to NATS Subject or Channels
1+
![NATS](logos/large-logo.png)
2+
3+
# NATS Replicator
4+
5+
[![License][License-Image]][License-Url]
6+
[![ReportCard][ReportCard-Image]][ReportCard-Url]
7+
[![Build][Build-Status-Image]][Build-Status-Url]
8+
[![Coverage][Coverage-Image]][Coverage-Url]
9+
10+
This project implements a multi-connector bridge between NATS and NATS streaming endpoints.
11+
12+
## WARNING DO NOT USE THIS SERVER YET
13+
14+
* This is the initial checkin
15+
* This code was just started
16+
* Tests do not pass
17+
* Doc is not right
18+
* Docker is not provided
19+
20+
## Features
21+
22+
* Arbitrary subjects in NATS, wildcards for incoming messages
23+
* Arbitrary channels in NATS streaming
24+
* Optional durable subscriber names for streaming
25+
* Configurable std-out logging
26+
* A single configuration file, with support for reload
27+
* Optional SSL to/from NATS and NATS streaming
28+
* HTTP/HTTPS-based monitoring endpoints for health or statistics
29+
30+
## Overview
31+
32+
The bridge runs as a single process with a configured set of connectors mapping a between a NATS subject or a NATS streaming channel. Each connector is a one-way bridge.
33+
34+
Connectors share a NATS connection and an optional connection to the NATS streaming server.
35+
36+
Request-reply is not supported.
37+
38+
The bridge is [configured with a NATS server-like format](docs/config.md), in a single file and uses the NATS logger.
39+
40+
An [optional HTTP/HTTPS endpoint](docs/monitoring.md) can be used for monitoring.
41+
42+
## Todo
43+
44+
* Integrate with travis and coveralls
45+
46+
## Documentation
47+
48+
* [Build & Run the Bridge](docs/buildandrun.md)
49+
* [Configuration](docs/config.md)
50+
* [Monitoring](docs/monitoring.md)
51+
52+
## External Resources
53+
54+
* [NATS](https://nats.io/documentation/)
55+
* [NATS server](https://github.com/nats-io/nats-server)
56+
* [NATS Streaming](https://github.com/nats-io/nats-streaming-server)
57+
58+
[License-Url]: https://www.apache.org/licenses/LICENSE-2.0
59+
[License-Image]: https://img.shields.io/badge/License-Apache2-blue.svg
60+
[Build-Status-Url]: https://travis-ci.com/nats-io/nats-replicator
61+
[Build-Status-Image]: https://travis-ci.com/nats-io/nats-replicator.svg?branch=master
62+
[Coverage-Url]: https://coveralls.io/r/nats-io/nats-replicator?branch=master
63+
[Coverage-image]: https://coveralls.io/repos/github/nats-io/nats-replicator/badge.svg?branch=master
64+
[ReportCard-Url]: https://goreportcard.com/report/nats-io/nats-replicator
65+
[ReportCard-Image]: https://goreportcard.com/badge/github.com/nats-io/nats-replicator
66+
67+
<a name="license"></a>
68+
69+
## License
70+
71+
Unless otherwise noted, the nats-replicator source files are distributed under the Apache Version 2.0 license found in the LICENSE file.

docs/buildandrun.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Build and Run the NATS-Replicator
2+
3+
## Running the server
4+
5+
The server will compile to an executable named `nats-replicator`. A [configuration](config.md) file is required to get any real behavior out of the server.
6+
7+
To specify the [configuration](config.md) file, use the `-c` flag:
8+
9+
```bash
10+
% nats-replicator -c <config file>
11+
```
12+
13+
You can use the `-D`, `-V` or `-DV` flags to turn on debug or verbose logging. The `-DV` option will turn on all logging, depending on the config file settings, these settings will override the ones in the config file.
14+
15+
<a name="build"></a>
16+
17+
## Building the Server
18+
19+
This project uses go modules and provides a make file. You should be able to simply:
20+
21+
```bash
22+
% git clone https://github.com/nats-io/nats-replicator.git
23+
% cd nats-replicator
24+
% make
25+
```
26+
27+
Use `make test` to run the tests, and `make install` to install. The nats and nats streaming servers are imported as go modules.
28+
29+
## Docker
30+
31+
!!! FIX THIS !!!
32+
33+
You can build the docker image using:
34+
35+
```bash
36+
% docker build . -t "nats-io/nats-replicator:0.5"
37+
```
38+
39+
Then run it with:
40+
41+
```bash
42+
% docker run -v <path to config>:/conf/replicator.conf "nats-io/nats-replicator:0.5" -c /conf/replicator.conf
43+
```
44+
45+
Be sure to include your monitoring port, for example, if port 9090 is used for monitoring, you can run with:
46+
47+
```bash
48+
% docker run -v <path to config>:/conf/replicator.conf -p 9090:9090 "nats-io/nats-replicator:0.5" -c /conf/replicator.conf
49+
```

0 commit comments

Comments
 (0)