<commit_before>package org.endeavourhealth.queuereader;

import com.google.common.base.Strings;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DefaultConsumer;
import com.rabbitmq.client.Envelope;
import org.endeavourhealth.common.config.ConfigManager;
import org.endeavourhealth.common.utility.MetricsHelper;
import org.endeavourhealth.common.utility.SlackHelper;
import org.endeavourhealth.core.application.ApplicationHeartbeatCallbackI;
import org.endeavourhealth.core.configuration.ComponentConfig;
import org.endeavourhealth.core.configuration.Pipeline;
import org.endeavourhealth.core.configuration.QueueReaderConfiguration;
import org.endeavourhealth.core.database.dal.DalProvider;
import org.endeavourhealth.core.database.dal.audit.QueuedMessageDalI;
import org.endeavourhealth.core.database.dal.audit.models.ApplicationHeartbeat;
import org.endeavourhealth.core.database.dal.audit.models.Exchange;
import org.endeavourhealth.core.database.dal.audit.models.HeaderKeys;
import org.endeavourhealth.core.messaging.pipeline.PipelineProcessor;
import org.endeavourhealth.core.messaging.pipeline.components.MessageTransformInbound;
import org.endeavourhealth.transform.common.TransformConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

public class RabbitConsumer extends DefaultConsumer
							implements ApplicationHeartbeatCallbackI {
	private static final Logger LOG = LoggerFactory.getLogger(RabbitConsumer.class);

	private static final String FILE_EXT_KILL = "kill";
	private static final String FILE_EXT_RESTART = "restart";

	private static final int EXIT_CODE_STOP = 0;
	private static final int EXIT_CODE_RESTART = 1025;

	//variables to prevent duplicate processing in the event of Rabbit fail-overs
	private static final List<RabbitConsumer_State> messagesBeingProcessed = new ArrayList<>();

	//members
	private final QueueReaderConfiguration configuration;
	private final String configId;
	private final RabbitHandler handler;
	private final PipelineProcessor pipeline;
	private int instanceNumber;
	private Boolean cachedIsInboundQueueReader;

	private RabbitConsumer_State lastExchangeAttempted;
	private int lastExchangeAttempts;
	private KillCheckingRunnable killCheckingRunnable;

	public RabbitConsumer(Channel channel, QueueReaderConfiguration configuration, String configId, RabbitHandler handler) {
		super(channel);

		this.configuration = configuration;
		this.configId = configId;
		this.handler = handler;
		this.pipeline = new PipelineProcessor(configuration.getPipeline());

		//call this to delete any pre-existing kill file
		checkIfKillFileExists(FILE_EXT_KILL);
		checkIfKillFileExists(FILE_EXT_RESTART);
		deleteExitCodeFile();

		startKillCheckingThread();
	}
<commit_msg>Changes to trigger build<commit_after>package org.endeavourhealth.queuereader;

import com.google.common.base.Strings;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DefaultConsumer;
import com.rabbitmq.client.Envelope;
import org.endeavourhealth.common.config.ConfigManager;
import org.endeavourhealth.common.utility.MetricsHelper;
import org.endeavourhealth.common.utility.SlackHelper;
import org.endeavourhealth.core.application.ApplicationHeartbeatCallbackI;
import org.endeavourhealth.core.configuration.ComponentConfig;
import org.endeavourhealth.core.configuration.Pipeline;
import org.endeavourhealth.core.configuration.QueueReaderConfiguration;
import org.endeavourhealth.core.database.dal.DalProvider;
import org.endeavourhealth.core.database.dal.audit.QueuedMessageDalI;
import org.endeavourhealth.core.database.dal.audit.models.ApplicationHeartbeat;
import org.endeavourhealth.core.database.dal.audit.models.Exchange;
import org.endeavourhealth.core.database.dal.audit.models.HeaderKeys;
import org.endeavourhealth.core.messaging.pipeline.PipelineProcessor;
import org.endeavourhealth.core.messaging.pipeline.components.MessageTransformInbound;
import org.endeavourhealth.transform.common.TransformConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

public class RabbitConsumer extends DefaultConsumer
							implements ApplicationHeartbeatCallbackI {
	private static final Logger LOG = LoggerFactory.getLogger(RabbitConsumer.class);

	private static final String FILE_EXT_KILL = "kill";
	private static final String FILE_EXT_RESTART = "restart";

	private static final int EXIT_CODE_STOP = 0;
	private static final int EXIT_CODE_RESTART = 1025;

	//variables to prevent duplicate processing in the event of Rabbit fail-overs
	private static final List<RabbitConsumer_State> messagesBeingProcessed = new ArrayList<>();

	//members-
	private final QueueReaderConfiguration configuration;
	private final String configId;
	private final RabbitHandler handler;
	private final PipelineProcessor pipeline;
	private int instanceNumber;
	private Boolean cachedIsInboundQueueReader;

	private RabbitConsumer_State lastExchangeAttempted;
	private int lastExchangeAttempts;
	private KillCheckingRunnable killCheckingRunnable;

	public RabbitConsumer(Channel channel, QueueReaderConfiguration configuration, String configId, RabbitHandler handler) {
		super(channel);

		this.configuration = configuration;
		this.configId = configId;
		this.handler = handler;
		this.pipeline = new PipelineProcessor(configuration.getPipeline());

		//call this to delete any pre-existing kill file
		checkIfKillFileExists(FILE_EXT_KILL);
		checkIfKillFileExists(FILE_EXT_RESTART);
		deleteExitCodeFile();

		startKillCheckingThread();
	}

{'fraction_non_alphanumeric': 0.07739680426098536, 'fraction_numerical': 0.002330226364846871, 'mean_word_length': 6.875491480996068, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '537903', 'n_tokens_mistral': 1781, 'n_tokens_neox': 1632, 'n_words': 359}