Bump deps + upd packages

This commit is contained in:
Egor Cherniak 2022-01-27 12:02:40 +03:00
parent 59913af8ee
commit db8c6deee2
No known key found for this signature in database
GPG Key ID: 26F47333B7BE4ED9
63 changed files with 208 additions and 483 deletions

33
pom.xml
View File

@ -4,28 +4,27 @@
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>
<parent> <parent>
<groupId>com.rbkmoney</groupId> <groupId>dev.vality</groupId>
<artifactId>parent</artifactId> <artifactId>library-parent-pom</artifactId>
<version>1.0.5</version> <version>1.0.2</version>
<relativePath/>
</parent> </parent>
<artifactId>sink-common-lib</artifactId> <artifactId>sink-common-lib</artifactId>
<version>0.0.8</version> <version>0.0.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>8</java.version> <java.version>15</java.version>
<lombok.version>1.18.4</lombok.version> <lombok.version>1.18.22</lombok.version>
<random-beans.version>[3.9.0,)</random-beans.version> <random-beans.version>3.9.0</random-beans.version>
<slf4j-api.version>1.7.30</slf4j-api.version> <slf4j-api.version>1.7.30</slf4j-api.version>
<junit.version>4.12</junit.version> <junit.version>4.13.2</junit.version>
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath> <sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
<woody.version>[1.1.21,)</woody.version> <woody.version>1.0.4</woody.version>
<damsel.version>1.439-b18f037</damsel.version> <damsel.version>1.544-dcd92dd</damsel.version>
<machinegun-proto.version>1.18-d814d69</machinegun-proto.version> <machinegun-proto.version>1.21-e4784ab</machinegun-proto.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -45,20 +44,20 @@
<version>${lombok.version}</version> <version>${lombok.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.rbkmoney.woody</groupId> <groupId>dev.vality.woody</groupId>
<artifactId>woody-thrift</artifactId> <artifactId>woody-thrift</artifactId>
<version>${woody.version}</version> <version>${woody.version}</version>
</dependency> </dependency>
<!-- rbk --> <!-- Vality -->
<dependency> <dependency>
<groupId>com.rbkmoney</groupId> <groupId>dev.vality</groupId>
<artifactId>damsel</artifactId> <artifactId>damsel</artifactId>
<version>${damsel.version}</version> <version>${damsel.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.rbkmoney</groupId> <groupId>dev.vality</groupId>
<artifactId>machinegun-proto</artifactId> <artifactId>machinegun-proto</artifactId>
<version>${machinegun-proto.version}</version> <version>${machinegun-proto.version}</version>
</dependency> </dependency>
@ -83,7 +82,7 @@
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version> <version>0.8.7</version>
<configuration> <configuration>
<destFile>${sonar.jacoco.reportPath}</destFile> <destFile>${sonar.jacoco.reportPath}</destFile>
<append>true</append> <append>true</append>

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.machineevent;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.EventHandler;
public interface MachineEventHandler<T> extends EventHandler<T, MachineEvent> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload;
import com.rbkmoney.damsel.payment_processing.EventPayload;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
public interface PaymentEventHandler extends MachineEventHandler<EventPayload> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload;
import com.rbkmoney.damsel.payout_processing.EventPayload;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
public interface PayoutEventHandler extends MachineEventHandler<EventPayload> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.change;
import com.rbkmoney.damsel.payment_processing.CustomerChange;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
public interface CustomerChangeEventHandler extends MachineEventHandler<CustomerChange> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.change;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
public interface InvoiceChangeEventHandler extends MachineEventHandler<InvoiceChange> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.change;
import com.rbkmoney.damsel.payment_processing.PartyChange;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
public interface PartyChangeEventHandler extends MachineEventHandler<PartyChange> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.change;
import com.rbkmoney.damsel.payout_processing.PayoutChange;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
public interface PayoutChangeEventHandler extends MachineEventHandler<PayoutChange> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.claimeffect;
import com.rbkmoney.damsel.payment_processing.ClaimEffect;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
public interface ClaimEffectEventHandler extends MachineEventHandler<ClaimEffect> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent;
import com.rbkmoney.damsel.event_stock.StockEvent;
import com.rbkmoney.sink.common.handle.EventHandler;
public interface StockEventHandler<T> extends EventHandler<T, StockEvent> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event;
import com.rbkmoney.damsel.payment_processing.Event;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
public interface PaymentEventHandler extends StockEventHandler<Event> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event;
import com.rbkmoney.damsel.payout_processing.Event;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
public interface PayoutEventHandler extends StockEventHandler<Event> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.change;
import com.rbkmoney.damsel.payment_processing.CustomerChange;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
public interface CustomerChangeEventHandler extends StockEventHandler<CustomerChange> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.change;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
public interface InvoiceChangeEventHandler extends StockEventHandler<InvoiceChange> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.change;
import com.rbkmoney.damsel.payment_processing.PartyChange;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
public interface PartyChangeEventHandler extends StockEventHandler<PartyChange> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.change;
import com.rbkmoney.damsel.payout_processing.PayoutChange;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
public interface PayoutChangeEventHandler extends StockEventHandler<PayoutChange> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.change.claimeffect;
import com.rbkmoney.damsel.payment_processing.ClaimEffect;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
public interface ClaimEffectEventHandler extends StockEventHandler<ClaimEffect> {
}

View File

@ -1,35 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.change.impl;
import com.rbkmoney.damsel.event_stock.StockEvent;
import com.rbkmoney.damsel.payment_processing.ClaimEffect;
import com.rbkmoney.damsel.payment_processing.PartyChange;
import com.rbkmoney.sink.common.handle.stockevent.event.change.PartyChangeEventHandler;
import com.rbkmoney.sink.common.handle.stockevent.event.change.claimeffect.ClaimEffectEventHandler;
import lombok.RequiredArgsConstructor;
import java.util.List;
@RequiredArgsConstructor
public class ClaimEffectStatusAcceptedChangeStockEventHandler implements PartyChangeEventHandler {
private final List<ClaimEffectEventHandler> eventsHandlers;
@Override
public boolean accept(PartyChange payload) {
return payload.isSetClaimStatusChanged()
&& payload.getClaimStatusChanged().getStatus().isSetAccepted()
&& payload.getClaimStatusChanged().getStatus().getAccepted().isSetEffects();
}
@Override
public void handle(PartyChange payload, StockEvent baseEvent) {
for (int i = 0; i < payload.getClaimStatusChanged().getStatus().getAccepted().getEffects().size(); i++) {
ClaimEffect effect = payload.getClaimStatusChanged().getStatus().getAccepted().getEffects().get(i);
for (ClaimEffectEventHandler eventsHandler : eventsHandlers) {
if (eventsHandler.accept(effect)) {
eventsHandler.handle(effect, baseEvent, i);
}
}
}
}
}

View File

@ -1,33 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.impl;
import com.rbkmoney.damsel.event_stock.StockEvent;
import com.rbkmoney.damsel.payment_processing.CustomerChange;
import com.rbkmoney.damsel.payment_processing.Event;
import com.rbkmoney.sink.common.handle.stockevent.event.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.stockevent.event.change.CustomerChangeEventHandler;
import lombok.RequiredArgsConstructor;
import java.util.List;
@RequiredArgsConstructor
public class CustomerChangePaymentStockEventHandler implements PaymentEventHandler {
private final List<CustomerChangeEventHandler> eventHandlers;
@Override
public boolean accept(Event payload) {
return payload.getPayload().isSetCustomerChanges();
}
@Override
public void handle(Event payload, StockEvent baseEvent) {
for (int i = 0; i < payload.getPayload().getCustomerChanges().size(); i++) {
CustomerChange change = payload.getPayload().getCustomerChanges().get(i);
for (CustomerChangeEventHandler eventHandler : eventHandlers) {
if (eventHandler.accept(change)) {
eventHandler.handle(change, baseEvent, i);
}
}
}
}
}

View File

@ -1,33 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.impl;
import com.rbkmoney.damsel.event_stock.StockEvent;
import com.rbkmoney.damsel.payment_processing.Event;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.sink.common.handle.stockevent.event.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.stockevent.event.change.InvoiceChangeEventHandler;
import lombok.RequiredArgsConstructor;
import java.util.List;
@RequiredArgsConstructor
public class InvoiceChangePaymentStockEventHandler implements PaymentEventHandler {
private final List<InvoiceChangeEventHandler> eventHandlers;
@Override
public boolean accept(Event payload) {
return payload.getPayload().isSetInvoiceChanges();
}
@Override
public void handle(Event payload, StockEvent baseEvent) {
for (int i = 0; i < payload.getPayload().getInvoiceChanges().size(); i++) {
InvoiceChange change = payload.getPayload().getInvoiceChanges().get(i);
for (InvoiceChangeEventHandler eventHandler : eventHandlers) {
if (eventHandler.accept(change)) {
eventHandler.handle(change, baseEvent, i);
}
}
}
}
}

View File

@ -1,33 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.impl;
import com.rbkmoney.damsel.event_stock.StockEvent;
import com.rbkmoney.damsel.payment_processing.Event;
import com.rbkmoney.damsel.payment_processing.PartyChange;
import com.rbkmoney.sink.common.handle.stockevent.event.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.stockevent.event.change.PartyChangeEventHandler;
import lombok.RequiredArgsConstructor;
import java.util.List;
@RequiredArgsConstructor
public class PartyChangePaymentStockEventHandler implements PaymentEventHandler {
private final List<PartyChangeEventHandler> eventHandlers;
@Override
public boolean accept(Event payload) {
return payload.getPayload().isSetPartyChanges();
}
@Override
public void handle(Event payload, StockEvent baseEvent) {
for (int i = 0; i < payload.getPayload().getPartyChanges().size(); i++) {
PartyChange change = payload.getPayload().getPartyChanges().get(i);
for (PartyChangeEventHandler eventHandler : eventHandlers) {
if (eventHandler.accept(change)) {
eventHandler.handle(change, baseEvent, i);
}
}
}
}
}

View File

@ -1,33 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.event.impl;
import com.rbkmoney.damsel.event_stock.StockEvent;
import com.rbkmoney.damsel.payout_processing.Event;
import com.rbkmoney.damsel.payout_processing.PayoutChange;
import com.rbkmoney.sink.common.handle.stockevent.event.PayoutEventHandler;
import com.rbkmoney.sink.common.handle.stockevent.event.change.PayoutChangeEventHandler;
import lombok.RequiredArgsConstructor;
import java.util.List;
@RequiredArgsConstructor
public class PayoutChangePayoutStockEventHandler implements PayoutEventHandler {
private final List<PayoutChangeEventHandler> eventHandlers;
@Override
public boolean accept(Event payload) {
return payload.getPayload().isSetPayoutChanges();
}
@Override
public void handle(Event payload, StockEvent baseEvent) {
for (int i = 0; i < payload.getPayload().getPayoutChanges().size(); i++) {
PayoutChange change = payload.getPayload().getPayoutChanges().get(i);
for (PayoutChangeEventHandler eventHandler : eventHandlers) {
if (eventHandler.accept(change)) {
eventHandler.handle(change, baseEvent, i);
}
}
}
}
}

View File

@ -1,30 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.impl;
import com.rbkmoney.damsel.event_stock.StockEvent;
import com.rbkmoney.damsel.payment_processing.Event;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
import com.rbkmoney.sink.common.handle.stockevent.event.PaymentEventHandler;
import lombok.RequiredArgsConstructor;
import java.util.List;
@RequiredArgsConstructor
public class PaymentEventStockEventHandler implements StockEventHandler<StockEvent> {
private final List<PaymentEventHandler> eventHandlers;
@Override
public boolean accept(StockEvent payload) {
return payload.getSourceEvent().isSetProcessingEvent();
}
@Override
public void handle(StockEvent payload, StockEvent baseEvent) {
Event event = payload.getSourceEvent().getProcessingEvent();
for (PaymentEventHandler eventHandler : eventHandlers) {
if (eventHandler.accept(event)) {
eventHandler.handle(event, baseEvent);
}
}
}
}

View File

@ -1,30 +0,0 @@
package com.rbkmoney.sink.common.handle.stockevent.impl;
import com.rbkmoney.damsel.event_stock.StockEvent;
import com.rbkmoney.damsel.payout_processing.Event;
import com.rbkmoney.sink.common.handle.stockevent.StockEventHandler;
import com.rbkmoney.sink.common.handle.stockevent.event.PayoutEventHandler;
import lombok.RequiredArgsConstructor;
import java.util.List;
@RequiredArgsConstructor
public class PayoutEventStockEventHandler implements StockEventHandler<StockEvent> {
private final List<PayoutEventHandler> eventHandlers;
@Override
public boolean accept(StockEvent payload) {
return payload.getSourceEvent().isSetPayoutEvent();
}
@Override
public void handle(StockEvent payload, StockEvent baseEvent) {
Event event = payload.getSourceEvent().getPayoutEvent();
for (PayoutEventHandler eventHandler : eventHandlers) {
if (eventHandler.accept(event)) {
eventHandler.handle(event, baseEvent);
}
}
}
}

View File

@ -1,7 +0,0 @@
package com.rbkmoney.sink.common.serialization.impl;
import com.rbkmoney.damsel.payment_processing.PartyEventData;
public class PartyEventDataSerializer extends ThriftBinarySerializer<PartyEventData> {
}

View File

@ -1,7 +0,0 @@
package com.rbkmoney.sink.common.serialization.impl;
import com.rbkmoney.damsel.payment_processing.EventPayload;
public class PaymentEventPayloadSerializer extends ThriftBinarySerializer<EventPayload> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.sink.common.serialization.impl;
import com.rbkmoney.damsel.payment_processing.EventPayload;
public class PayoutEventPayloadSerializer extends ThriftBinarySerializer<EventPayload> {
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.exception; package dev.vality.sink.common.exception;
public class ParseException extends RuntimeException { public class ParseException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.exception; package dev.vality.sink.common.exception;
public class ThriftBinaryDeserializationException extends RuntimeException { public class ThriftBinaryDeserializationException extends RuntimeException {
@ -17,7 +17,8 @@ public class ThriftBinaryDeserializationException extends RuntimeException {
super(cause); super(cause);
} }
public ThriftBinaryDeserializationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { public ThriftBinaryDeserializationException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace); super(message, cause, enableSuppression, writableStackTrace);
} }
} }

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.exception; package dev.vality.sink.common.exception;
public class ThriftBinarySerializationException extends RuntimeException { public class ThriftBinarySerializationException extends RuntimeException {
@ -17,7 +17,8 @@ public class ThriftBinarySerializationException extends RuntimeException {
super(cause); super(cause);
} }
public ThriftBinarySerializationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { public ThriftBinarySerializationException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace); super(message, cause, enableSuppression, writableStackTrace);
} }
} }

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.handle; package dev.vality.sink.common.handle;
public interface EventHandler<E, B> { public interface EventHandler<E, B> {

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.handle.machineevent;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.handle.EventHandler;
public interface MachineEventHandler<T> extends EventHandler<T, MachineEvent> {
}

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.handle.machineevent.eventpayload;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
public interface PaymentEventHandler extends MachineEventHandler<EventPayload> {
}

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.handle.machineevent.eventpayload;
import dev.vality.damsel.payout_processing.EventPayload;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
public interface PayoutEventHandler extends MachineEventHandler<EventPayload> {
}

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.handle.machineevent.eventpayload.change;
import dev.vality.damsel.payment_processing.CustomerChange;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
public interface CustomerChangeEventHandler extends MachineEventHandler<CustomerChange> {
}

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.handle.machineevent.eventpayload.change;
import dev.vality.damsel.payment_processing.InvoiceChange;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
public interface InvoiceChangeEventHandler extends MachineEventHandler<InvoiceChange> {
}

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.handle.machineevent.eventpayload.change;
import dev.vality.damsel.payment_processing.PartyChange;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
public interface PartyChangeEventHandler extends MachineEventHandler<PartyChange> {
}

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.handle.machineevent.eventpayload.change;
import dev.vality.damsel.payout_processing.PayoutChange;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
public interface PayoutChangeEventHandler extends MachineEventHandler<PayoutChange> {
}

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.handle.machineevent.eventpayload.change.claimeffect;
import dev.vality.damsel.payment_processing.ClaimEffect;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
public interface ClaimEffectEventHandler extends MachineEventHandler<ClaimEffect> {
}

View File

@ -1,10 +1,10 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.impl; package dev.vality.sink.common.handle.machineevent.eventpayload.change.impl;
import com.rbkmoney.damsel.payment_processing.ClaimEffect; import dev.vality.damsel.payment_processing.ClaimEffect;
import com.rbkmoney.damsel.payment_processing.PartyChange; import dev.vality.damsel.payment_processing.PartyChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.PartyChangeEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.change.PartyChangeEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.claimeffect.ClaimEffectEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.change.claimeffect.ClaimEffectEventHandler;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import java.util.List; import java.util.List;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.impl; package dev.vality.sink.common.handle.machineevent.eventpayload.impl;
import com.rbkmoney.damsel.payment_processing.CustomerChange; import dev.vality.damsel.payment_processing.CustomerChange;
import com.rbkmoney.damsel.payment_processing.EventPayload; import dev.vality.damsel.payment_processing.EventPayload;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PaymentEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.CustomerChangeEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.change.CustomerChangeEventHandler;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.impl; package dev.vality.sink.common.handle.machineevent.eventpayload.impl;
import com.rbkmoney.damsel.payment_processing.EventPayload; import dev.vality.damsel.payment_processing.EventPayload;
import com.rbkmoney.damsel.payment_processing.InvoiceChange; import dev.vality.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PaymentEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.InvoiceChangeEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.change.InvoiceChangeEventHandler;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import java.util.List; import java.util.List;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.impl; package dev.vality.sink.common.handle.machineevent.eventpayload.impl;
import com.rbkmoney.damsel.payment_processing.EventPayload; import dev.vality.damsel.payment_processing.EventPayload;
import com.rbkmoney.damsel.payment_processing.PartyChange; import dev.vality.damsel.payment_processing.PartyChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PaymentEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.PartyChangeEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.change.PartyChangeEventHandler;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import java.util.List; import java.util.List;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.sink.common.handle.machineevent.eventpayload.impl; package dev.vality.sink.common.handle.machineevent.eventpayload.impl;
import com.rbkmoney.damsel.payout_processing.EventPayload; import dev.vality.damsel.payout_processing.EventPayload;
import com.rbkmoney.damsel.payout_processing.PayoutChange; import dev.vality.damsel.payout_processing.PayoutChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PayoutEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.PayoutEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.PayoutChangeEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.change.PayoutChangeEventHandler;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import java.util.List; import java.util.List;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.sink.common.handle.machineevent.impl; package dev.vality.sink.common.handle.machineevent.impl;
import com.rbkmoney.damsel.payment_processing.EventPayload; import dev.vality.damsel.payment_processing.EventPayload;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler; import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PaymentEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import java.util.List; import java.util.List;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.sink.common.handle.machineevent.impl; package dev.vality.sink.common.handle.machineevent.impl;
import com.rbkmoney.damsel.payout_processing.EventPayload; import dev.vality.damsel.payout_processing.EventPayload;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler; import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PayoutEventHandler; import dev.vality.sink.common.handle.machineevent.eventpayload.PayoutEventHandler;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.parser; package dev.vality.sink.common.parser;
public interface Parser<F, T> { public interface Parser<F, T> {

View File

@ -1,9 +1,9 @@
package com.rbkmoney.sink.common.parser.impl; package dev.vality.sink.common.parser.impl;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.exception.ParseException; import dev.vality.sink.common.exception.ParseException;
import com.rbkmoney.sink.common.parser.Parser; import dev.vality.sink.common.parser.Parser;
import com.rbkmoney.sink.common.serialization.BinaryDeserializer; import dev.vality.sink.common.serialization.BinaryDeserializer;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.sink.common.parser.impl; package dev.vality.sink.common.parser.impl;
import com.rbkmoney.damsel.payment_processing.PartyEventData; import dev.vality.damsel.payment_processing.PartyEventData;
import com.rbkmoney.sink.common.serialization.BinaryDeserializer; import dev.vality.sink.common.serialization.BinaryDeserializer;
public class PartyEventDataMachineEventParser extends MachineEventParser<PartyEventData> { public class PartyEventDataMachineEventParser extends MachineEventParser<PartyEventData> {

View File

@ -1,7 +1,7 @@
package com.rbkmoney.sink.common.parser.impl; package dev.vality.sink.common.parser.impl;
import com.rbkmoney.damsel.payment_processing.EventPayload; import dev.vality.damsel.payment_processing.EventPayload;
import com.rbkmoney.sink.common.serialization.BinaryDeserializer; import dev.vality.sink.common.serialization.BinaryDeserializer;
public class PaymentEventPayloadMachineEventParser extends MachineEventParser<EventPayload> { public class PaymentEventPayloadMachineEventParser extends MachineEventParser<EventPayload> {

View File

@ -1,7 +1,7 @@
package com.rbkmoney.sink.common.parser.impl; package dev.vality.sink.common.parser.impl;
import com.rbkmoney.damsel.payout_processing.EventPayload; import dev.vality.damsel.payout_processing.EventPayload;
import com.rbkmoney.sink.common.serialization.BinaryDeserializer; import dev.vality.sink.common.serialization.BinaryDeserializer;
public class PayoutEventPayloadMachineEventParser extends MachineEventParser<EventPayload> { public class PayoutEventPayloadMachineEventParser extends MachineEventParser<EventPayload> {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.serialization; package dev.vality.sink.common.serialization;
public interface BinaryDeserializer<T> { public interface BinaryDeserializer<T> {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.serialization; package dev.vality.sink.common.serialization;
public interface BinarySerializer<T> { public interface BinarySerializer<T> {

View File

@ -1,16 +1,23 @@
package com.rbkmoney.sink.common.serialization.impl; package dev.vality.sink.common.serialization.impl;
import com.rbkmoney.sink.common.exception.ThriftBinaryDeserializationException; import dev.vality.sink.common.exception.ThriftBinaryDeserializationException;
import com.rbkmoney.sink.common.serialization.BinaryDeserializer; import dev.vality.sink.common.serialization.BinaryDeserializer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TBase; import org.apache.thrift.TBase;
import org.apache.thrift.TDeserializer; import org.apache.thrift.TDeserializer;
import org.apache.thrift.TException; import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransportException;
@Slf4j @Slf4j
public abstract class AbstractThriftBinaryDeserializer<T extends TBase> implements BinaryDeserializer<T> { public abstract class AbstractThriftBinaryDeserializer<T extends TBase> implements BinaryDeserializer<T> {
private final ThreadLocal<TDeserializer> thriftDeserializer = ThreadLocal.withInitial(TDeserializer::new); private final ThreadLocal<TDeserializer> thriftDeserializer = ThreadLocal.withInitial(() -> {
try {
return new TDeserializer();
} catch (TTransportException e) {
throw new RuntimeException(e);
}
});
protected T deserialize(byte[] bin, T t) { protected T deserialize(byte[] bin, T t) {
log.debug("Deserialize, bin[]: {}", bin.length); log.debug("Deserialize, bin[]: {}", bin.length);

View File

@ -1,6 +1,6 @@
package com.rbkmoney.sink.common.serialization.impl; package dev.vality.sink.common.serialization.impl;
import com.rbkmoney.damsel.payment_processing.PartyEventData; import dev.vality.damsel.payment_processing.PartyEventData;
public class PartyEventDataDeserializer extends AbstractThriftBinaryDeserializer<PartyEventData> { public class PartyEventDataDeserializer extends AbstractThriftBinaryDeserializer<PartyEventData> {

View File

@ -0,0 +1,7 @@
package dev.vality.sink.common.serialization.impl;
import dev.vality.damsel.payment_processing.PartyEventData;
public class PartyEventDataSerializer extends ThriftBinarySerializer<PartyEventData> {
}

View File

@ -1,6 +1,6 @@
package com.rbkmoney.sink.common.serialization.impl; package dev.vality.sink.common.serialization.impl;
import com.rbkmoney.damsel.payment_processing.EventPayload; import dev.vality.damsel.payment_processing.EventPayload;
public class PaymentEventPayloadDeserializer extends AbstractThriftBinaryDeserializer<EventPayload> { public class PaymentEventPayloadDeserializer extends AbstractThriftBinaryDeserializer<EventPayload> {

View File

@ -0,0 +1,7 @@
package dev.vality.sink.common.serialization.impl;
import dev.vality.damsel.payment_processing.EventPayload;
public class PaymentEventPayloadSerializer extends ThriftBinarySerializer<EventPayload> {
}

View File

@ -1,6 +1,6 @@
package com.rbkmoney.sink.common.serialization.impl; package dev.vality.sink.common.serialization.impl;
import com.rbkmoney.damsel.payout_processing.EventPayload; import dev.vality.damsel.payout_processing.EventPayload;
public class PayoutEventPayloadDeserializer extends AbstractThriftBinaryDeserializer<EventPayload> { public class PayoutEventPayloadDeserializer extends AbstractThriftBinaryDeserializer<EventPayload> {

View File

@ -0,0 +1,8 @@
package dev.vality.sink.common.serialization.impl;
import dev.vality.damsel.payment_processing.EventPayload;
public class PayoutEventPayloadSerializer extends ThriftBinarySerializer<EventPayload> {
}

View File

@ -1,16 +1,23 @@
package com.rbkmoney.sink.common.serialization.impl; package dev.vality.sink.common.serialization.impl;
import com.rbkmoney.sink.common.exception.ThriftBinarySerializationException; import dev.vality.sink.common.exception.ThriftBinarySerializationException;
import com.rbkmoney.sink.common.serialization.BinarySerializer; import dev.vality.sink.common.serialization.BinarySerializer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TBase; import org.apache.thrift.TBase;
import org.apache.thrift.TException; import org.apache.thrift.TException;
import org.apache.thrift.TSerializer; import org.apache.thrift.TSerializer;
import org.apache.thrift.transport.TTransportException;
@Slf4j @Slf4j
public class ThriftBinarySerializer<T extends TBase> implements BinarySerializer<T> { public class ThriftBinarySerializer<T extends TBase> implements BinarySerializer<T> {
private final ThreadLocal<TSerializer> thriftSerializer = ThreadLocal.withInitial(TSerializer::new); private final ThreadLocal<TSerializer> thriftSerializer = ThreadLocal.withInitial(() -> {
try {
return new TSerializer();
} catch (TTransportException e) {
throw new RuntimeException(e);
}
});
@Override @Override
public byte[] serialize(T data) { public byte[] serialize(T data) {

View File

@ -1,11 +1,11 @@
package com.rbkmoney.sink.common.parser; package dev.vality.sink.common.parser;
import com.rbkmoney.damsel.payment_processing.EventPayload; import dev.vality.damsel.payment_processing.EventPayload;
import com.rbkmoney.machinegun.eventsink.MachineEvent; import dev.vality.machinegun.eventsink.MachineEvent;
import com.rbkmoney.machinegun.msgpack.Value; import dev.vality.machinegun.msgpack.Value;
import com.rbkmoney.sink.common.parser.impl.PaymentEventPayloadMachineEventParser; import dev.vality.sink.common.parser.impl.PaymentEventPayloadMachineEventParser;
import com.rbkmoney.sink.common.serialization.impl.PaymentEventPayloadDeserializer; import dev.vality.sink.common.serialization.impl.PaymentEventPayloadDeserializer;
import com.rbkmoney.sink.common.serialization.impl.PaymentEventPayloadSerializer; import dev.vality.sink.common.serialization.impl.PaymentEventPayloadSerializer;
import org.junit.Test; import org.junit.Test;
import java.util.Collections; import java.util.Collections;
@ -25,7 +25,8 @@ public class ParserTest {
MachineEvent machineEvent = random(MachineEvent.class, "data"); MachineEvent machineEvent = random(MachineEvent.class, "data");
machineEvent.setData(Value.bin(serializeEventPayload)); machineEvent.setData(Value.bin(serializeEventPayload));
PaymentEventPayloadMachineEventParser parser = new PaymentEventPayloadMachineEventParser(new PaymentEventPayloadDeserializer()); PaymentEventPayloadMachineEventParser parser =
new PaymentEventPayloadMachineEventParser(new PaymentEventPayloadDeserializer());
EventPayload actualEventPayload = parser.parse(machineEvent); EventPayload actualEventPayload = parser.parse(machineEvent);
assertEquals(expectedEventPayload, actualEventPayload); assertEquals(expectedEventPayload, actualEventPayload);

View File

@ -1,8 +1,8 @@
package com.rbkmoney.sink.common.serialization; package dev.vality.sink.common.serialization;
import com.rbkmoney.damsel.payment_processing.EventPayload; import dev.vality.damsel.payment_processing.EventPayload;
import com.rbkmoney.sink.common.serialization.impl.PaymentEventPayloadDeserializer; import dev.vality.sink.common.serialization.impl.PaymentEventPayloadDeserializer;
import com.rbkmoney.sink.common.serialization.impl.PaymentEventPayloadSerializer; import dev.vality.sink.common.serialization.impl.PaymentEventPayloadSerializer;
import org.junit.Test; import org.junit.Test;
import java.util.Collections; import java.util.Collections;