This commit is contained in:
parent
24f8934541
commit
239e593c61
11
pom.xml
11
pom.xml
|
|
@ -492,11 +492,12 @@
|
|||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.baidu.aip</groupId>-->
|
||||
<!-- <artifactId>java-sdk</artifactId>-->
|
||||
<!-- <version>4.11.3</version>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sproutsocial</groupId>
|
||||
<artifactId>nsq-j</artifactId>
|
||||
<version>1.4.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.sqx.nsq;
|
||||
|
||||
import com.sproutsocial.nsq.Subscriber;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
public class PubExample {
|
||||
|
||||
public static void handleData(byte[] data) {
|
||||
System.out.println("Received:" + new String(data));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Subscriber subscriber = new Subscriber("47.122.26.160");
|
||||
subscriber.subscribe("test", "channel1", PubExample::handleData);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,11 @@ server:
|
|||
servlet:
|
||||
context-path: /czg
|
||||
|
||||
nsq:
|
||||
lookup-addresses: 127.0.0.1:4161 # 这里填写你的NSQ lookupd服务地址和端口,示例用本地地址
|
||||
topic: test_topic # 定义要使用的NSQ主题
|
||||
channel: test_channel # 定义NSQ通道
|
||||
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
|
|
|
|||
Loading…
Reference in New Issue