rename clearing-utils -> clearing-validation
This commit is contained in:
parent
de137377bc
commit
0f3ef112a4
16 changed files with 75 additions and 75 deletions
|
|
@ -4,8 +4,8 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>clearing-utils</artifactId> <!-- todo refactor - rename to clearing-validation -->
|
<artifactId>clearing-validation</artifactId> <!-- todo refactor - rename to clearing-validation -->
|
||||||
<name>clearing-utils</name>
|
<name>clearing-validation</name>
|
||||||
<description>Clearing-module, dependency version of platform-utils</description>
|
<description>Clearing-module, dependency version of platform-utils</description>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>SPCEX-1.0.0.0</version>
|
<version>SPCEX-1.0.0.0</version>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/**
|
/**
|
||||||
* Утилиты с зависимостями от множества модулей clearing-*
|
* Утилиты с зависимостями от множества модулей clearing-*
|
||||||
*/
|
*/
|
||||||
package ru.spcex.clearing.util;
|
package ru.spcex.clearing.util;
|
||||||
|
|
@ -1,66 +1,66 @@
|
||||||
package ru.spcex.clearing.util.services.exchangers;
|
package ru.spcex.clearing.util.services.exchangers;
|
||||||
|
|
||||||
import org.apache.kafka.clients.consumer.Consumer;
|
import org.apache.kafka.clients.consumer.Consumer;
|
||||||
import org.apache.kafka.clients.producer.Producer;
|
import org.apache.kafka.clients.producer.Producer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Синхронный обмен сообщениями с ассинхронным сервисом.
|
* Синхронный обмен сообщениями с ассинхронным сервисом.
|
||||||
* Метод exchange() отправляет сообщение в очередь и дожидается ответа из другой очереди
|
* Метод exchange() отправляет сообщение в очередь и дожидается ответа из другой очереди
|
||||||
*/
|
*/
|
||||||
public class BiDirectionQueueExchanger<TIn, TOut extends BaseRequest<?>> extends QueueConsumer implements InitializingBean, DisposableBean {
|
public class BiDirectionQueueExchanger<TIn, TOut extends BaseRequest<?>> extends QueueConsumer implements InitializingBean, DisposableBean {
|
||||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
protected final Object sync = new Object();
|
protected final Object sync = new Object();
|
||||||
protected String outQueue;
|
protected String outQueue;
|
||||||
protected String inQueue;
|
protected String inQueue;
|
||||||
protected Class<TIn> listenClass;
|
protected Class<TIn> listenClass;
|
||||||
protected long timeout;
|
protected long timeout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Синхронно-ассинхронный обмен сообщениями
|
* Синхронно-ассинхронный обмен сообщениями
|
||||||
*
|
*
|
||||||
* @param kafkaQueue
|
* @param kafkaQueue
|
||||||
* @param kafkaProducer
|
* @param kafkaProducer
|
||||||
* @param outQueue отправляет в очередь
|
* @param outQueue отправляет в очередь
|
||||||
* @param inQueue слушает очередь, ожидает ответов
|
* @param inQueue слушает очередь, ожидает ответов
|
||||||
* @param listenClass типы объектов из inQueue
|
* @param listenClass типы объектов из inQueue
|
||||||
* @param timeout - максимальное ожидание ответа, в миллисекундах, 0 - неограничено
|
* @param timeout - максимальное ожидание ответа, в миллисекундах, 0 - неограничено
|
||||||
*/
|
*/
|
||||||
public BiDirectionQueueExchanger(Consumer<String, Object> kafkaQueue, Producer<String, Object> kafkaProducer,
|
public BiDirectionQueueExchanger(Consumer<String, Object> kafkaQueue, Producer<String, Object> kafkaProducer,
|
||||||
String outQueue,
|
String outQueue,
|
||||||
String inQueue, Class<TIn> listenClass,
|
String inQueue, Class<TIn> listenClass,
|
||||||
long timeout) {
|
long timeout) {
|
||||||
super(kafkaQueue, kafkaProducer);
|
super(kafkaQueue, kafkaProducer);
|
||||||
this.outQueue = outQueue;
|
this.outQueue = outQueue;
|
||||||
this.inQueue = inQueue;
|
this.inQueue = inQueue;
|
||||||
this.listenClass = listenClass;
|
this.listenClass = listenClass;
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Отправить сообщение message в outQueue и дождаться ответа из очереди inQueue
|
* Отправить сообщение message в outQueue и дождаться ответа из очереди inQueue
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* @return
|
* @return
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public TOut exchange(TIn message) throws InterruptedException {
|
public TOut exchange(TIn message) throws InterruptedException {
|
||||||
//todo impl BiDirectionQueueExchanger
|
//todo impl BiDirectionQueueExchanger
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() throws Exception {
|
public void destroy() throws Exception {
|
||||||
log.debug("Listener {} for async exchange {}-{} close", this, outQueue, inQueue);
|
log.debug("Listener {} for async exchange {}-{} close", this, outQueue, inQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
log.debug("Listener {} for async exchange {}-{} ready", this, outQueue, inQueue);
|
log.debug("Listener {} for async exchange {}-{} ready", this, outQueue, inQueue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ru.spcex.clearing</groupId>
|
<groupId>ru.spcex.clearing</groupId>
|
||||||
<artifactId>clearing-utils</artifactId>
|
<artifactId>clearing-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<module>backend-api</module>
|
<module>backend-api</module>
|
||||||
<module>imdg</module>
|
<module>imdg</module>
|
||||||
<module>security-util</module>
|
<module>security-util</module>
|
||||||
<module>clearing-utils</module>
|
<module>clearing-validation</module>
|
||||||
<module>db-scripts</module>
|
<module>db-scripts</module>
|
||||||
<module>dbf-importer</module>
|
<module>dbf-importer</module>
|
||||||
<module>dbf-exporter</module>
|
<module>dbf-exporter</module>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ru.spcex.clearing</groupId>
|
<groupId>ru.spcex.clearing</groupId>
|
||||||
<artifactId>clearing-utils</artifactId>
|
<artifactId>clearing-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ru.spcex.platform</groupId>
|
<groupId>ru.spcex.platform</groupId>
|
||||||
|
|
|
||||||
2
pom.xml
2
pom.xml
|
|
@ -96,7 +96,7 @@
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ru.spcex.clearing</groupId>
|
<groupId>ru.spcex.clearing</groupId>
|
||||||
<artifactId>clearing-utils</artifactId>
|
<artifactId>clearing-validation</artifactId>
|
||||||
<version>${global.project.version}</version>
|
<version>${global.project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue