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