ENTAXY-374 release 1.8.2

This commit is contained in:
2022-08-23 13:40:11 +03:00
parent b68642f81c
commit 1061b96c7e
616 changed files with 60896 additions and 3202 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ru.entaxy.esb.system.registry</groupId>
<artifactId>registry</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
<relativePath>../../registry/pom.xml</relativePath>
</parent>

View File

@ -26,6 +26,11 @@ import java.util.Map;
public interface Connector {
public static final String HEADERS_START = "NTX_Connector_";
public static final String ROLE = "role";
public static final String TYPE = "type";
public static final String SUBTYPE = "subtype";
String getEndpointName();
String getEndpointType();

View File

@ -33,6 +33,9 @@ public class DirectVMInConnectorImpl extends CommonConnector implements InConnec
@Override
public void send(Exchange exchange) {
ProducerTemplate template = exchange.getContext().createProducerTemplate();
exchange.getIn().setHeader(HEADERS_START + ROLE, getParam(ROLE));
exchange.getIn().setHeader(HEADERS_START + TYPE, getParam(TYPE));
exchange.getIn().setHeader(HEADERS_START + SUBTYPE, getParam(SUBTYPE));
template.send("direct-vm:" + endpointName + "-" + endpointType + "-connector-" + systemName +
"?block=true&timeout=60000", exchange);
}

View File

@ -25,12 +25,18 @@ import ru.entaxy.esb.system.profile.commons.connectors.out.OutConnector;
import java.util.List;
import static ru.entaxy.esb.system.profile.commons.connectors.Connector.*;
public interface ProfileOutput {
OutConnector getOutConnector(String systemName);
OutConnector getOutConnector(String endpointName, String role, String type, String subtype);
void send(Exchange exchange);
void sendTo(@Header("EndpointName") String endpointName, Exchange exchange);
void sendTo(@Header("EndpointName") String endpointName,
@Header(HEADERS_START + ROLE) String role,
@Header(HEADERS_START + TYPE) String type,
@Header(HEADERS_START + SUBTYPE) String subtype,
Exchange exchange);
public List<String> getReferenceNames();
}

View File

@ -31,6 +31,8 @@ import ru.entaxy.esb.system.common.exception.ConnectorNotFound;
import ru.entaxy.esb.system.common.osgi.impl.CommonNamedReferenceListener;
import ru.entaxy.esb.system.profile.commons.connectors.out.OutConnector;
import static ru.entaxy.esb.system.profile.commons.connectors.Connector.*;
public class ProfileOutputImpl extends CommonNamedReferenceListener<OutConnector> implements ProfileOutput {
private static final Logger log = LoggerFactory.getLogger(ProfileOutputImpl.class);
@ -42,8 +44,20 @@ public class ProfileOutputImpl extends CommonNamedReferenceListener<OutConnector
}
@Override
public OutConnector getOutConnector(String endpointName) {
if (endpointName == null || registeredReferences.get(endpointName) == null) {
public OutConnector getOutConnector(String endpointName, String role, String type, String subtype) {
for (OutConnector outConnector : registeredReferences.values()) {
if ((role == null || role.equals(outConnector.getParam(ROLE))) &&
type != null && type.equals(outConnector.getParam(TYPE)) &&
subtype != null && subtype.equals(outConnector.getParam(SUBTYPE))) {
return outConnector;
} else if ((role == null || role.equals(outConnector.getParam(ROLE))) &&
type != null && type.equals(outConnector.getParam(TYPE))) {
return outConnector;
} else if (role != null && role.equals(outConnector.getParam(ROLE))) {
return outConnector;
}
}
if (endpointName == null || registeredReferences.get(endpointName) == null) {
for (OutConnector outConnector : registeredReferences.values()) {
return outConnector;
}
@ -106,9 +120,13 @@ public class ProfileOutputImpl extends CommonNamedReferenceListener<OutConnector
}
@Override
public void sendTo(@Header("ENTAXY_EndpointName") String endpointName, Exchange exchange) {
public void sendTo(@Header("ENTAXY_EndpointName") String endpointName,
@Header(HEADERS_START + ROLE) String role,
@Header(HEADERS_START + TYPE) String type,
@Header(HEADERS_START + SUBTYPE) String subtype,
Exchange exchange) {
try {
getOutConnector(endpointName).send(exchange);
getOutConnector(endpointName, role, type, subtype).send(exchange);
} catch (NullPointerException ex) {
throw new ConnectorNotFound("Out connector for " + systemName + " not found");
}