测试
This commit is contained in:
11
pom.xml
11
pom.xml
@@ -492,11 +492,12 @@
|
|||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--<dependency>-->
|
|
||||||
<!--<groupId>com.baidu.aip</groupId>-->
|
<dependency>
|
||||||
<!-- <artifactId>java-sdk</artifactId>-->
|
<groupId>com.sproutsocial</groupId>
|
||||||
<!-- <version>4.11.3</version>-->
|
<artifactId>nsq-j</artifactId>
|
||||||
<!--</dependency>-->
|
<version>1.4.9</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
20
src/main/java/com/sqx/nsq/PubExample.java
Normal file
20
src/main/java/com/sqx/nsq/PubExample.java
Normal file
@@ -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:
|
servlet:
|
||||||
context-path: /czg
|
context-path: /czg
|
||||||
|
|
||||||
|
nsq:
|
||||||
|
lookup-addresses: 127.0.0.1:4161 # 这里填写你的NSQ lookupd服务地址和端口,示例用本地地址
|
||||||
|
topic: test_topic # 定义要使用的NSQ主题
|
||||||
|
channel: test_channel # 定义NSQ通道
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
main:
|
main:
|
||||||
allow-circular-references: true
|
allow-circular-references: true
|
||||||
|
|||||||
Reference in New Issue
Block a user