From 7e2d2c074c3f09266dda31c772f4bec61e8d5742 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 6 May 2014 22:03:39 +0200 Subject: o Support for listening on messages too. o Configurable topic name. --- .../org/jenkinsci/plugins/activemq/ActiveMqPlugin.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/jenkinsci/plugins/activemq/ActiveMqPlugin.java') diff --git a/src/main/java/org/jenkinsci/plugins/activemq/ActiveMqPlugin.java b/src/main/java/org/jenkinsci/plugins/activemq/ActiveMqPlugin.java index 6ec65c0..c9c277c 100644 --- a/src/main/java/org/jenkinsci/plugins/activemq/ActiveMqPlugin.java +++ b/src/main/java/org/jenkinsci/plugins/activemq/ActiveMqPlugin.java @@ -8,12 +8,14 @@ import jenkins.model.GlobalConfiguration; import org.slf4j.Logger; import javax.annotation.Nonnull; +import javax.jms.JMSException; +import java.net.URISyntaxException; import java.util.Map; import static org.slf4j.LoggerFactory.getLogger; @Extension -public class ActiveMqPlugin extends Plugin /*implements ReconfigurableDescribable*/ { +public class ActiveMqPlugin extends Plugin implements ActiveMqClient.BuildRequestListener /*implements ReconfigurableDescribable*/ { // public static final String DISPLAY_NAME = "ActiveMQ Plugin Display Name"; @@ -66,7 +68,13 @@ public class ActiveMqPlugin extends Plugin /*implements ReconfigurableDescribabl } log.info("Creating client of broker {}", brokerUrl); - client = new ActiveMqClient(brokerUrl); + try { + client = new ActiveMqClient(brokerUrl, config.getTopicName(), this); + } catch (JMSException e) { + log.warn("Unable to connect to queue"); + } catch (URISyntaxException e) { + log.warn("Unable to connect to queue"); + } } else { if (client != null) { log.info("Disposing current JMS client."); @@ -75,4 +83,10 @@ public class ActiveMqPlugin extends Plugin /*implements ReconfigurableDescribabl } } } + + @Override + public void onBuildRequest(ActiveMqClient.BuildRequest req) { + log.info("ActiveMqPlugin.onBuildRequest"); + log.info(req.parameters.toString()); + } } -- cgit v1.2.3