@@ -0,0 +1,2657 @@
+package org.jenkinsci.plugins.rabbitmqconsumer;%0A%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0A%0Aimport org.kohsuke.stapler.export.Exported;%0Aimport org.kohsuke.stapler.export.ExportedBean;%0A%0Aimport hudson.Plugin;%0Aimport hudson.model.Api;%0A%0A/**%0A * A plugin class%0A *%0A * @author rinrinne (rinrin.ne@gmail.com)%0A */%0A@ExportedBean%0Apublic class RabbitMQConsumer extends Plugin %7B%0A%0A    /**%0A     * Gets api%0A     * @return the api.%0A     */%0A    public Api getApi() %7B%0A        return new Api(this);%0A    %7D%0A%0A    /**%0A     * Gets configuration is enabled or not.%0A     *%0A     * @return true if so.%0A     */%0A    @Exported%0A    public boolean isEnabled() %7B%0A        return GlobalRabbitmqConfiguration.get().isEnableConsumer();%0A    %7D%0A%0A    /**%0A     * Gets connection is established or not.%0A     *%0A     * @return true if so.%0A     */%0A    @Exported%0A    public boolean isConnected() %7B%0A        return GlobalRabbitmqConfiguration.get().isOpen();%0A    %7D%0A%0A    /**%0A     * Gets configured service URI.%0A     *%0A     * @return the URI.%0A     */%0A    @Exported%0A    public String getServiceUri() %7B%0A        return GlobalRabbitmqConfiguration.get().getServiceUri();%0A    %7D%0A%0A    /**%0A     * Gets configured username.%0A     *%0A     * @return the username.%0A     */%0A    @Exported%0A    public String getUserName() %7B%0A        return GlobalRabbitmqConfiguration.get().getUserName();%0A    %7D%0A%0A    /**%0A     * Gets the list of configured queues.%0A     *%0A     * @return the list of queues.%0A     */%0A    @Exported%0A    public List%3CQueueState%3E getQueues() %7B%0A        List%3CQueueState%3E stats = new LinkedList%3CQueueState%3E();%0A        List%3CRabbitmqConsumeItem%3E queues = GlobalRabbitmqConfiguration.get().getConsumeItems();%0A        for (RabbitmqConsumeItem queue : queues) %7B%0A            QueueState state = new QueueState(queue.getQueueName(), queue.getAppId(),%0A                    RMQManager.getInstance().getChannelStatus(queue.getQueueName()));%0A            stats.add(state);%0A        %7D%0A        return stats;%0A    %7D%0A%0A    /**%0A     * An inner class to represent the status of queue.%0A     *%0A     * @author rinrinne (rinrin.ne@gmail.com)%0A     */%0A    @ExportedBean%0A    public static final class QueueState %7B%0A%0A        @Exported%0A        public final String name;%0A        @Exported%0A        public final String appId;%0A        @Exported%0A        public final boolean consumed;%0A%0A        /**%0A         * Constructor.%0A         *%0A         * @param name the name.%0A         * @param appId the application id.%0A         * @param consumed true if consumed.%0A         */%0A        QueueState(String name, String appId, boolean consumed) %7B%0A            this.name = name;%0A            this.appId = appId;%0A            this.consumed = consumed;%0A        %7D%0A    %7D%0A%7D%0A

Add plugin class