blob: 25fc87ead537bfe45a0a114dd53f56ab97d03337 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package org.onap.ccsdk.sli.adaptors.messagerouter.publisher.client.impl;
import org.onap.ccsdk.sli.adaptors.messagerouter.publisher.api.PublisherApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClientImpl {
private static final Logger logger = LoggerFactory.getLogger(ClientImpl.class);
private String topic;
private PublisherApi publisher;
public void setPublisher(PublisherApi publisherApi) {
this.publisher = publisherApi;
}
public void setTopic(String topic) {
this.topic = topic;
}
public ClientImpl() {
}
public void init() {
for (int i = 0; i < 5; i++) {
String body = "{\"hello\":\"world " + String.valueOf(Math.random()) + "\"}";
logger.error("Loop iteration " + i + " sending body " + body + " to the topic " + topic);
Boolean result = publisher.publish(topic, body);
logger.error("Loop iteration " + i + " returned the boolean value " + result);
}
}
}
|