mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-14 17:58:27 +00:00
Save point: [skip ci]
* tidy up
This commit is contained in:
@@ -146,8 +146,7 @@ public class QueueTransformService
|
||||
{
|
||||
try
|
||||
{
|
||||
TransformRequest request = (TransformRequest) transformMessageConverter
|
||||
.fromMessage(msg);
|
||||
TransformRequest request = (TransformRequest) transformMessageConverter.fromMessage(msg);
|
||||
return Optional.ofNullable(request);
|
||||
}
|
||||
catch (MessageConversionException e)
|
||||
|
@@ -27,14 +27,11 @@
|
||||
|
||||
package org.alfresco.transformer.messaging;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Message;
|
||||
import javax.jms.Session;
|
||||
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jms.support.converter.MappingJackson2MessageConverter;
|
||||
import org.springframework.jms.support.converter.MessageConversionException;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
@@ -42,9 +39,9 @@ import org.springframework.jms.support.converter.MessageType;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Message;
|
||||
import javax.jms.Session;
|
||||
|
||||
/**
|
||||
* TODO: Duplicated from the Router
|
||||
@@ -55,8 +52,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
@Service
|
||||
public class TransformMessageConverter implements MessageConverter
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(TransformMessageConverter.class);
|
||||
|
||||
private static final MappingJackson2MessageConverter converter;
|
||||
private static final JavaType TRANSFORM_REQUEST_TYPE =
|
||||
TypeFactory.defaultInstance().constructType(TransformRequest.class);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Transform Core
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* -
|
||||
@@ -56,22 +56,23 @@ public class TransformReplySender
|
||||
send(destination, reply, reply.getRequestId());
|
||||
}
|
||||
|
||||
public void send(final Destination destination, final TransformReply reply,
|
||||
final String correlationId)
|
||||
public void send(final Destination destination, final TransformReply reply, final String correlationId)
|
||||
{
|
||||
try
|
||||
if (destination != null)
|
||||
{
|
||||
//jmsTemplate.setSessionTransacted(true); // do we need this?
|
||||
jmsTemplate.convertAndSend(destination, reply, m -> {
|
||||
m.setJMSCorrelationID(correlationId);
|
||||
return m;
|
||||
});
|
||||
logger.trace("Sent: {} - with correlation ID {}", reply, correlationId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.error(
|
||||
"Failed to send T-Reply " + reply + " - for correlation ID " + correlationId, e);
|
||||
try
|
||||
{
|
||||
//jmsTemplate.setSessionTransacted(true); // do we need this?
|
||||
jmsTemplate.convertAndSend(destination, reply, m -> {
|
||||
m.setJMSCorrelationID(correlationId);
|
||||
return m;
|
||||
});
|
||||
logger.trace("Sent: {} - with correlation ID {}", reply, correlationId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.error("Failed to send T-Reply " + reply + " - for correlation ID " + correlationId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -220,8 +220,7 @@ public abstract class AbstractTransformerControllerTest
|
||||
return testFileUrl == null ? null : testFile;
|
||||
}
|
||||
|
||||
protected MockHttpServletRequestBuilder mockMvcRequest(String url, MockMultipartFile sourceFile,
|
||||
String... params)
|
||||
protected MockHttpServletRequestBuilder mockMvcRequest(String url, MockMultipartFile sourceFile, String... params)
|
||||
{
|
||||
if (sourceFile == null)
|
||||
{
|
||||
|
@@ -29,12 +29,14 @@ package org.alfresco.transformer;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Source & Target media type pair
|
||||
*
|
||||
* @author Cezar Leahu
|
||||
*/
|
||||
public class SourceTarget
|
||||
{
|
||||
final String source;
|
||||
final String target;
|
||||
public final String source;
|
||||
public final String target;
|
||||
|
||||
private SourceTarget(final String source, final String target)
|
||||
{
|
||||
@@ -65,11 +67,6 @@ public class SourceTarget
|
||||
}
|
||||
|
||||
public static SourceTarget of(final String source, final String target)
|
||||
{
|
||||
return sourceTarget(source, target);
|
||||
}
|
||||
|
||||
public static SourceTarget sourceTarget(final String source, final String target)
|
||||
{
|
||||
return new SourceTarget(source, target);
|
||||
}
|
||||
|
Reference in New Issue
Block a user