<commit_before>package com.emarte.regurgitator.extensions.mq;

import com.emarte.regurgitator.core.*;
import com.emarte.regurgitator.core.Message;

import javax.jms.*;

import static com.emarte.regurgitator.core.Log.getLog;
import static com.emarte.regurgitator.core.StringType.stringify;
import static com.emarte.regurgitator.extensions.mq.MessageResponseUtil.applyResponseData;

public class MqResponseCallback implements ResponseCallBack {
	private static final Log log = getLog(MqResponseCallback.class);
	private final MqMessagingSystem mqMessagingSystem;
	private final String outputQueue;

	public MqResponseCallback(MqMessagingSystem mqMessagingSystem, String outputQueue) {
		this.mqMessagingSystem = mqMessagingSystem;
		this.outputQueue = outputQueue;
	}

	@Override
	public void respond(Message message, Object value) {
		try {
			log.debug("Processing callback");
			QueueSession session = mqMessagingSystem.getConnection().createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
			QueueSender sender = session.createSender(session.createQueue(outputQueue));
			javax.jms.TextMessage jmsMessage = mqMessagingSystem.createTextMessage();

			log.debug("Applying message data to jms message");
			applyResponseData(message, jmsMessage);

			log.debug("Adding response payload to jms message");
			jmsMessage.setText(stringify(value));

			log.debug("Sending response message");
			sender.send(jmsMessage);
			session.close();
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}
}<commit_msg>tidied, and overrides destination in mq response callback<commit_after>package com.emarte.regurgitator.extensions.mq;

import com.emarte.regurgitator.core.*;
import com.emarte.regurgitator.core.Message;

import javax.jms.*;

import static com.emarte.regurgitator.core.Log.getLog;
import static com.emarte.regurgitator.core.StringType.stringify;
import static com.emarte.regurgitator.extensions.mq.ExtensionsMqConfigConstants.JMS_DESTINATION;
import static com.emarte.regurgitator.extensions.mq.ExtensionsMqConfigConstants.RESPONSE_METADATA_CONTEXT;
import static com.emarte.regurgitator.extensions.mq.MessageResponseUtil.applyResponseData;

public class MqResponseCallback implements ResponseCallBack {
	private static final Log log = getLog(MqResponseCallback.class);
	private final MqMessagingSystem mqMessagingSystem;
	private final String defaultOutputQueue;

	public MqResponseCallback(MqMessagingSystem mqMessagingSystem, String defaultOutputQueue) {
		this.mqMessagingSystem = mqMessagingSystem;
		this.defaultOutputQueue = defaultOutputQueue;
	}

	@Override
	public void respond(Message message, Object value) {
		try {
			log.debug("Processing callback");
			Parameter destinationParameter = message.getContextValue(new ContextLocation(RESPONSE_METADATA_CONTEXT, JMS_DESTINATION));
			String destination = destinationParameter != null ? stringify(destinationParameter.getValue()) : defaultOutputQueue;

			if(destinationParameter != null) {
				log.debug("Overriding jms destination with parameter value '" + destination + "'");
			}

			QueueSession session = mqMessagingSystem.getConnection().createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
			QueueSender sender = session.createSender(session.createQueue(destination));
			javax.jms.TextMessage jmsMessage = mqMessagingSystem.createTextMessage();

			log.debug("Applying message data to jms message");
			applyResponseData(message, jmsMessage);

			log.debug("Adding response payload to jms message");
			jmsMessage.setText(stringify(value));

			log.debug("Sending response message");
			sender.send(jmsMessage);
			session.close();
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}
}
{'fraction_non_alphanumeric': 0.09379235565193819, 'fraction_numerical': 0.0, 'mean_word_length': 6.165048543689321, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6989885', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1068, 'n_words': 211}