class DecideRuleSequenceWithAMQPFeed extends DecideRuleSequence {
    private static final long serialVersionUID = 1L;

    private static final Logger logger =
            Logger.getLogger(DecideRuleSequenceWithAMQPFeed.class.getName());

    protected String amqpUri = "amqp://guest:guest@localhost:5672/%2f";
    public String getAmqpUri() {
        return this.amqpUri;
    }
    public void setAmqpUri(String uri) {
        this.amqpUri = uri;
    }

    protected String exchange = "heritrix.realTimeFeed";
    public String getExchange() {
        return exchange;
    }
    public void setExchange(String exchange) {
        this.exchange = exchange;
    }

    protected String routingKey = "scopeLog";
    public String getRoutingKey() {
        return routingKey;
    }
    public void setRoutingKey(String routingKey) {
        this.routingKey = routingKey;
    }

    protected ServerCache serverCache;
    public ServerCache getServerCache() {
        return this.serverCache;
    }
    @Autowired
    public void setServerCache(ServerCache serverCache) {
        this.serverCache = serverCache;
    }

    transient protected AMQPProducer amqpProducer;

    protected AMQPProducer amqpProducer() {
        if (amqpProducer == null) {
            amqpProducer = new AMQPProducer(getAmqpUri(), getExchange(), getRoutingKey());
        }
        return amqpProducer;
    }

    @Override
    synchronized public void stop() {
        if (!isRunning) {
            return;
        }

        super.stop();

        if (amqpProducer != null) {
            amqpProducer.stop();
        }
    }

    @Override
    protected void decisionMade(CrawlURI curi, DecideRule decisiveRule,
            int decisiveRuleNumber, DecideResult result) {
        super.decisionMade(curi, decisiveRule, decisiveRuleNumber, result);

        JSONObject jo = buildJson(curi, decisiveRuleNumber, decisiveRule,
                result);

        byte[] message;
        try {
            message = jo.toString().getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }

        try {
            amqpProducer().publishMessage(message, props);
            if (logger.isLoggable(Level.FINEST)) {
                logger.log(Level.FINEST, "sent message to amqp: " + jo);
            }
        } catch (IOException e) {
            logger.log(Level.WARNING, "failed to send message to amqp: " + jo, e);
        }
    }

    protected BasicProperties props = new AMQP.BasicProperties.Builder().
            contentType("application/json").build();

    protected JSONObject buildJson(CrawlURI curi, int decisiveRuleNumber,
            DecideRule decisiveRule, DecideResult result) {<FILL_FUNCTION_BODY>}
}

        JSONObject jo = new JSONObject();

        jo.put("timestamp", ArchiveUtils.getLog17Date(System.currentTimeMillis()));

        jo.put("decisiveRuleNo", decisiveRuleNumber);
        jo.put("decisiveRule", decisiveRule.getClass().getSimpleName());
        jo.put("result", result.toString());

        jo.put("url", curi.toString());

        CrawlHost host = getServerCache().getHostFor(curi.getUURI());
        if (host != null) {
            jo.put("host", host.fixUpName());
        } else {
            jo.put("host", JSONObject.NULL);
        }

        jo.put("sourceSeed", curi.getSourceTag());
        jo.put("via", curi.flattenVia());
        return jo;
    
<methods>public non-sealed void <init>() ,public java.lang.String getBeanName() ,public boolean getLogExtraInfo() ,public boolean getLogToFile() ,public org.archive.modules.SimpleFileLoggerProvider getLoggerModule() ,public List<org.archive.modules.deciderules.DecideRule> getRules() ,public org.archive.modules.net.ServerCache getServerCache() ,public org.archive.modules.deciderules.DecideResult innerDecide(org.archive.modules.CrawlURI) ,public boolean isRunning() ,public void setBeanName(java.lang.String) ,public void setLogExtraInfo(boolean) ,public void setLogToFile(boolean) ,public void setLoggerModule(org.archive.modules.SimpleFileLoggerProvider) ,public void setRules(List<org.archive.modules.deciderules.DecideRule>) ,public void setServerCache(org.archive.modules.net.ServerCache) ,public void start() ,public void stop() <variables>private static final java.util.logging.Logger LOGGER,protected java.lang.String beanName,protected transient java.util.logging.Logger fileLogger,protected boolean isRunning,protected boolean logExtraInfo,protected org.archive.modules.SimpleFileLoggerProvider loggerModule,private static final long serialVersionUID,protected org.archive.modules.net.ServerCache serverCache