package org.apache.activemq.isolation;

import org.apache.activemq.isolation.NoLockException;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Paths;

import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.BrokerFilter;
import org.apache.activemq.broker.ProducerBrokerExchange;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.command.ConnectionInfo;
import org.apache.activemq.command.Message;
import org.apache.activemq.broker.region.MessageReference;
import org.apache.activemq.util.ByteSequence;

public class IsolationBroker extends BrokerFilter {

	List<String> messagesToInspect;
	
	public IsolationBroker(Broker next, List<String> messagesToInspect) {
		super(next);
		this.messagesToInspect = messagesToInspect;
	}

	public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
		super.addConnection(context, info);
	}	

	public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception, NoLockException {
		byte[] data = messageSend.getContent().data;
		String content = new String(data, 0, data.length, "ASCII");

		if (content.contains("test")) {
			throw new NoLockException("Test lock");
		}

		super.send(producerExchange, messageSend);
	}
	
}

@@ -573,30 +573,142 @@
 emq.
-command.ConnectionInfo
+broker.region.MessageReference;%0Aimport org.apache.activemq.broker.ConsumerBrokerExchange;%0Aimport org.apache.activemq.util.ByteSequence
 ;%0Aim
@@ -747,16 +747,18 @@
 .Message
+Id
 ;%0Aimport
@@ -782,83 +782,120 @@
 emq.
-broker.region.MessageReference;%0Aimport org.apache.activemq.util.ByteSequenc
+command.MessageAck;%0Aimport org.apache.activemq.command.ConnectionInfo;%0Aimport org.apache.activemq.command.Messag
 e;%0A%0A
@@ -1255,16 +1255,204 @@
 );%0A%09%7D%09%0A%0A
+%09public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception %7B%0A%09%09System.out.println(%22Acknoweldge!!%22);%0A%09%09super.acknowledge(consumerExchange, ack);%0A%09%7D%0A%0A
 %09public 

Add basic acknoweldge stub