Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Change the format of the data put on the bus
Browse files Browse the repository at this point in the history
  • Loading branch information
pilhuhn authored and jmazzitelli committed Feb 17, 2015
1 parent 631fe39 commit 4ae9ac8
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Publish metrics data
Expand Down Expand Up @@ -72,19 +74,24 @@ public void sendToMetricsViaRest(String tenantId, List<SingleMetric> metrics) {

/**
* Put a list of metric data on the Metrics topic.
* @param tenantId
* @param metrics Metrics to publish
*/
@Asynchronous
public void publishToTopic(List<SingleMetric> metrics) {
public void publishToTopic(String tenantId, List<SingleMetric> metrics) {
if (topic != null) {

ConnectionContextFactory factory = null;
try {

Map<String,Object> data = new HashMap<>(2);
data.put("tenantId",tenantId);
data.put("data",metrics);

Endpoint endpoint = new Endpoint(Endpoint.Type.TOPIC,topic.getTopicName());
factory = new ConnectionContextFactory(connectionFactory);
ProducerConnectionContext pc = factory.createProducerConnectionContext(endpoint);
BasicMessage msg = new ObjectMessage(metrics);
BasicMessage msg = new ObjectMessage(data);
MessageProcessor processor = new MessageProcessor();
processor.send(pc, msg);
}
Expand Down

0 comments on commit 4ae9ac8

Please sign in to comment.