Merge pull request #3 from valitydev/ft/build

Build impl
This commit is contained in:
Egor Cherniak 2022-01-27 16:36:12 +03:00 committed by GitHub
commit 19fbd81008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 256 additions and 503 deletions

10
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,10 @@
name: Maven Build Artifact
on:
pull_request:
branches:
- '*'
jobs:
build:
uses: valitydev/base-workflow/.github/workflows/maven-library-build.yml@v1

16
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: Maven Deploy Artifact
on:
push:
branches:
- 'master'
- 'main'
jobs:
deploy:
uses: valitydev/base-workflow/.github/workflows/maven-library-deploy.yml@v1
secrets:
server-username: ${{ secrets.OSSRH_USERNAME }}
server-password: ${{ secrets.OSSRH_TOKEN }}
deploy-secret-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
deploy-secret-key-password: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git
branch = master

4
.lgtm.yml Normal file
View File

@ -0,0 +1,4 @@
extraction:
java:
index:
java_version: "15"

13
Jenkinsfile vendored
View File

@ -1,13 +0,0 @@
#!groovy
build('sink-common-lib', 'docker-host') {
checkoutRepo()
loadBuildUtils()
def javaLibPipeline
runStage('load JavaLib pipeline') {
javaLibPipeline = load("build_utils/jenkins_lib/pipeJavaLib.groovy")
}
def buildImageTag = "fcf116dd775cc2e91bffb6a36835754e3f2d5321"
javaLibPipeline(buildImageTag)
}

View File

@ -1,7 +1,5 @@
# sink-common-lib
[![Build Status](http://ci.rbkmoney.com/buildStatus/icon?job=rbkmoney_private/sink-common-lib/master)](http://ci.rbkmoney.com/job/rbkmoney_private/job/sink-common-lib/job/master/)
Библиотека для переиспользования вздаимодействия с протоколами, обрабатываемые machinegun'ном:
- eventsink (hellgate)
- sinkievent (machinegun)

@ -1 +0,0 @@
Subproject commit e89b885839df8013df804d48ff24dff10c9c451e

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

18
renovate.json Normal file
View File

@ -0,0 +1,18 @@
{
"extends": [
"config:base"
],
"packageRules": [
{
"matchPackagePatterns": [
"*"
],
"matchUpdateTypes": [
"minor",
"patch"
],
"groupName": "all non-major dependencies",
"groupSlug": "all-minor-patch"
}
]
}

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 {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.exception;
package dev.vality.sink.common.exception;
public class ThriftBinaryDeserializationException extends RuntimeException {
@ -17,7 +17,8 @@ public class ThriftBinaryDeserializationException extends RuntimeException {
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);
}
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.exception;
package dev.vality.sink.common.exception;
public class ThriftBinarySerializationException extends RuntimeException {
@ -17,7 +17,8 @@ public class ThriftBinarySerializationException extends RuntimeException {
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);
}
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.handle;
package dev.vality.sink.common.handle;
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 com.rbkmoney.damsel.payment_processing.PartyChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.PartyChangeEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.claimeffect.ClaimEffectEventHandler;
import dev.vality.damsel.payment_processing.ClaimEffect;
import dev.vality.damsel.payment_processing.PartyChange;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.handle.machineevent.eventpayload.change.PartyChangeEventHandler;
import dev.vality.sink.common.handle.machineevent.eventpayload.change.claimeffect.ClaimEffectEventHandler;
import lombok.RequiredArgsConstructor;
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 com.rbkmoney.damsel.payment_processing.EventPayload;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.CustomerChangeEventHandler;
import dev.vality.damsel.payment_processing.CustomerChange;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import dev.vality.sink.common.handle.machineevent.eventpayload.change.CustomerChangeEventHandler;
import lombok.RequiredArgsConstructor;
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 com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.InvoiceChangeEventHandler;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.damsel.payment_processing.InvoiceChange;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import dev.vality.sink.common.handle.machineevent.eventpayload.change.InvoiceChangeEventHandler;
import lombok.RequiredArgsConstructor;
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 com.rbkmoney.damsel.payment_processing.PartyChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.PartyChangeEventHandler;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.damsel.payment_processing.PartyChange;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import dev.vality.sink.common.handle.machineevent.eventpayload.change.PartyChangeEventHandler;
import lombok.RequiredArgsConstructor;
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 com.rbkmoney.damsel.payout_processing.PayoutChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PayoutEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.change.PayoutChangeEventHandler;
import dev.vality.damsel.payout_processing.EventPayload;
import dev.vality.damsel.payout_processing.PayoutChange;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.handle.machineevent.eventpayload.PayoutEventHandler;
import dev.vality.sink.common.handle.machineevent.eventpayload.change.PayoutChangeEventHandler;
import lombok.RequiredArgsConstructor;
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 com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
import dev.vality.sink.common.handle.machineevent.eventpayload.PaymentEventHandler;
import lombok.RequiredArgsConstructor;
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 com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.sink.common.handle.machineevent.MachineEventHandler;
import com.rbkmoney.sink.common.handle.machineevent.eventpayload.PayoutEventHandler;
import dev.vality.damsel.payout_processing.EventPayload;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.handle.machineevent.MachineEventHandler;
import dev.vality.sink.common.handle.machineevent.eventpayload.PayoutEventHandler;
import lombok.RequiredArgsConstructor;
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> {

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 com.rbkmoney.sink.common.exception.ParseException;
import com.rbkmoney.sink.common.parser.Parser;
import com.rbkmoney.sink.common.serialization.BinaryDeserializer;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.sink.common.exception.ParseException;
import dev.vality.sink.common.parser.Parser;
import dev.vality.sink.common.serialization.BinaryDeserializer;
import lombok.RequiredArgsConstructor;
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 com.rbkmoney.sink.common.serialization.BinaryDeserializer;
import dev.vality.damsel.payment_processing.PartyEventData;
import dev.vality.sink.common.serialization.BinaryDeserializer;
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 com.rbkmoney.sink.common.serialization.BinaryDeserializer;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.sink.common.serialization.BinaryDeserializer;
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 com.rbkmoney.sink.common.serialization.BinaryDeserializer;
import dev.vality.damsel.payout_processing.EventPayload;
import dev.vality.sink.common.serialization.BinaryDeserializer;
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> {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.sink.common.serialization;
package dev.vality.sink.common.serialization;
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 com.rbkmoney.sink.common.serialization.BinaryDeserializer;
import dev.vality.sink.common.exception.ThriftBinaryDeserializationException;
import dev.vality.sink.common.serialization.BinaryDeserializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TBase;
import org.apache.thrift.TDeserializer;
import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransportException;
@Slf4j
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) {
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> {

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> {

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> {

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 com.rbkmoney.sink.common.serialization.BinarySerializer;
import dev.vality.sink.common.exception.ThriftBinarySerializationException;
import dev.vality.sink.common.serialization.BinarySerializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TBase;
import org.apache.thrift.TException;
import org.apache.thrift.TSerializer;
import org.apache.thrift.transport.TTransportException;
@Slf4j
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
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 com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.machinegun.msgpack.Value;
import com.rbkmoney.sink.common.parser.impl.PaymentEventPayloadMachineEventParser;
import com.rbkmoney.sink.common.serialization.impl.PaymentEventPayloadDeserializer;
import com.rbkmoney.sink.common.serialization.impl.PaymentEventPayloadSerializer;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.machinegun.msgpack.Value;
import dev.vality.sink.common.parser.impl.PaymentEventPayloadMachineEventParser;
import dev.vality.sink.common.serialization.impl.PaymentEventPayloadDeserializer;
import dev.vality.sink.common.serialization.impl.PaymentEventPayloadSerializer;
import org.junit.Test;
import java.util.Collections;
@ -25,7 +25,8 @@ public class ParserTest {
MachineEvent machineEvent = random(MachineEvent.class, "data");
machineEvent.setData(Value.bin(serializeEventPayload));
PaymentEventPayloadMachineEventParser parser = new PaymentEventPayloadMachineEventParser(new PaymentEventPayloadDeserializer());
PaymentEventPayloadMachineEventParser parser =
new PaymentEventPayloadMachineEventParser(new PaymentEventPayloadDeserializer());
EventPayload actualEventPayload = parser.parse(machineEvent);
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 com.rbkmoney.sink.common.serialization.impl.PaymentEventPayloadDeserializer;
import com.rbkmoney.sink.common.serialization.impl.PaymentEventPayloadSerializer;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.sink.common.serialization.impl.PaymentEventPayloadDeserializer;
import dev.vality.sink.common.serialization.impl.PaymentEventPayloadSerializer;
import org.junit.Test;
import java.util.Collections;