summaryrefslogtreecommitdiff
path: root/calamus-jenkins-plugin/src/main/java
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2014-04-12 20:37:55 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2014-04-12 20:37:55 +0200
commita521a2d74c480c53c1004e7e5e2addd28a0578f4 (patch)
treef6d36cdecb56bc35f18faf496c8251a14f3f3a26 /calamus-jenkins-plugin/src/main/java
parentbfcfcf5e3b4301bc94c27f47bfda61693edf3595 (diff)
downloadcalamus-a521a2d74c480c53c1004e7e5e2addd28a0578f4.tar.gz
calamus-a521a2d74c480c53c1004e7e5e2addd28a0578f4.tar.bz2
calamus-a521a2d74c480c53c1004e7e5e2addd28a0578f4.tar.xz
calamus-a521a2d74c480c53c1004e7e5e2addd28a0578f4.zip
wip
Diffstat (limited to 'calamus-jenkins-plugin/src/main/java')
-rw-r--r--calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java b/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java
index 6ca4264..01e4176 100644
--- a/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java
+++ b/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java
@@ -6,10 +6,13 @@ import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
-import javax.jms.MapMessage;
import javax.jms.MessageProducer;
import javax.jms.Session;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.util.Properties;
+import static java.lang.String.valueOf;
import static javax.jms.Session.AUTO_ACKNOWLEDGE;
public class MqClient {
@@ -32,16 +35,18 @@ public class MqClient {
MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
- MapMessage message = session.createMapMessage();
- message.setString("jobName", jobName);
- message.setInt("buildNumber", buildNumber);
- message.setString("result", result);
+ Properties properties = new Properties();
+ properties.setProperty("jobName", jobName);
+ properties.setProperty("buildNumber", valueOf(buildNumber));
+ properties.setProperty("result", result);
- producer.send(message);
+ CharArrayWriter buf = new CharArrayWriter();
+ properties.store(buf, null);
+ producer.send(session.createTextMessage(buf.toString()));
session.close();
connection.close();
- } catch (JMSException e) {
+ } catch (JMSException | IOException e) {
e.printStackTrace();
}
}