-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# nats-spring | ||
### Configuring a NATS client in Spring | ||
This project provides support for using Spring Boot with [NATS](https://nats.io/). | ||
|
||
# Quick Start | ||
clone this project | ||
```bash | ||
git clone https://github.com/wanlinus/nats-spring.git | ||
cd nats-spring | ||
mvn clean install | ||
``` | ||
|
||
```xml | ||
<dependency> | ||
<groupId>cn.wanlinus</groupId> | ||
<artifactId>nats-spring</artifactId> | ||
<version>1.0.0.RELEASE</version> | ||
</dependency> | ||
``` | ||
The Java SE 8 or higher is recommended to build the project. | ||
|
||
## Basic Usage | ||
|
||
```java | ||
@SpringBootApplication | ||
@EnableNats | ||
public class NatsDemo2Application { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(NatsDemo2Application.class, args); | ||
} | ||
} | ||
``` | ||
|
||
```java | ||
|
||
@Component | ||
public class Foo{ | ||
|
||
@NatsSubscribe("haha") | ||
public void message(Message message) { | ||
System.out.println(message.getSubject() + " : " + new String(message.getData())); | ||
} | ||
} | ||
``` | ||
|
||
# Resources | ||
|
||
For more information, please visit the Nats Spring website at: | ||
[Reference Manual](https://github.com/wanlinus/nats-spring) | ||
|
||
|
||
# License | ||
|
||
Nats-Spring is released under the terms of the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html). | ||
|
||
|