summaryrefslogtreecommitdiff
path: root/calamus-jenkins-plugin/src/main/java/org/jenkinsci
diff options
context:
space:
mode:
Diffstat (limited to 'calamus-jenkins-plugin/src/main/java/org/jenkinsci')
-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();
}
}