ENTAXY-248 release 1.8.1

This commit is contained in:
2022-02-28 15:20:38 +03:00
parent 4d274c4fcc
commit c826adf1db
1958 changed files with 195926 additions and 10280 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ru.entaxy.esb.system.registry</groupId>
<artifactId>registry</artifactId>
<version>1.8.0</version>
<version>1.8.1</version>
<relativePath>../../registry/pom.xml</relativePath>
</parent>
@ -32,7 +32,8 @@
ru.entaxy.esb.system.common.osgi.impl;version="[1.0,2)",
org.apache.commons.logging,
org.osgi.service.blueprint;version="[1.0.0,2.0.0)",
ru.entaxy.esb.system.core.dispatcher
ru.entaxy.esb.system.core.dispatcher,
*
</bundle.osgi.import.pkg>
</properties>

View File

@ -23,7 +23,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.ProducerTemplate;
import ru.entaxy.esb.system.profile.commons.connectors.CommonConnector;
public class QueueInConnectorImpl extends CommonConnector implements InConnector {
public class DirectVMInConnectorImpl extends CommonConnector implements InConnector {
@Override
public String getEndpointType() {

View File

@ -23,7 +23,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.ProducerTemplate;
import ru.entaxy.esb.system.profile.commons.connectors.CommonConnector;
public class QueueOutConnectorImpl extends CommonConnector implements OutConnector {
public class DirectVMOutConnectorImpl extends CommonConnector implements OutConnector {
@Override
public String getEndpointType() {

View File

@ -19,15 +19,22 @@
*/
package ru.entaxy.esb.system.profile.commons.profile_output;
import java.util.concurrent.CountDownLatch;
import org.apache.camel.Exchange;
import org.apache.camel.Header;
import org.apache.camel.ProducerTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
public class ProfileOutputImpl extends CommonNamedReferenceListener<OutConnector> implements ProfileOutput {
private static final Logger log = LoggerFactory.getLogger(ProfileOutputImpl.class);
protected String systemName;
public void setSystemName(String systemName) {
@ -46,8 +53,56 @@ public class ProfileOutputImpl extends CommonNamedReferenceListener<OutConnector
@Override
public void send(Exchange exchange) {
ProducerTemplate template = exchange.getContext().createProducerTemplate();
template.send("direct-vm:profile-" + systemName + "-enter-point?block=true&timeout=60000", exchange);
/*
* !!! WE ARE NOT SURE THE SENDING FROM PROCESSOR (COMPONENT) IS ALLOWED IN CAMEL !!!
* but we managed to do this
*
* we need another Thread to execute because when sending
* from system to itself the execution stops in waiting forever
* due to existing running ReactiveExecutor will be found for this thread
* and the task will be placed in it's queue while being in
* execution of the previous task from another Workers's queue
* of the same ReactiveExecutor
*
* Example (without separate thread):
*
* profile_s1 (ExtendedCamelContext_1 -> ReactiveExecutor_1)
* -> task (we're in it now!) -> [switch to ExtendedCamelContext_2] producer (vmdirect)
* -> ExtendedCamelContext_2 (with ReactiveExecutor_2) (route_s1)
* -> consumer (profile_s1)
* -> task {
* Who will execute? Let's check if there's already a ReactiveExecutor !!for current Thread!!
* in target context. If no, our executor will be used.
* Oh! We've found ReactiveExecutor_1, it will execute.
* } -> enqueue (ReactiveExecutor_1)
* -> (execution is still in ExtendedCamelContext_2 - route_s1)
* -> wait for task to be executed.
*
* Result: being in previous (current) task we're waiting for the next task
* in the same ReactiveExecutor's queue to be executed.
* This will never happen.
*
*/
CountDownLatch latch = new CountDownLatch(1);
Thread exec = new Thread(new Runnable() {
@Override
public void run() {
ProducerTemplate template = exchange.getContext().createProducerTemplate();
template.send("direct-vm:profile-" + systemName + "-enter-point?block=true&timeout=60000", exchange);
latch.countDown();
}
});
exec.setContextClassLoader(Thread.currentThread().getContextClassLoader());
exec.start();
try {
// we have to wait the thread to be executed
// because we're calling synchronously
latch.await();
} catch (InterruptedException e) {
// e.printStackTrace();
log.error("Error awaiting latch", e);
}
}
@Override