-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
29 changed files
with
127 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package com.rbkmoney.hooker.handler; | ||
|
||
import com.rbkmoney.geck.filter.Filter; | ||
|
||
/** | ||
* Created by inal on 24.11.2016. | ||
*/ | ||
public interface Handler<T> { | ||
|
||
boolean accept(T value); | ||
|
||
void handle(T value) throws PollingException; | ||
public interface Handler<C, P> { | ||
default boolean accept(C change) { | ||
return getFilter().match(change); | ||
} | ||
void handle(C change, P parent); | ||
Filter getFilter(); | ||
} |
14 changes: 0 additions & 14 deletions
14
src/main/java/com/rbkmoney/hooker/handler/PollingException.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
src/main/java/com/rbkmoney/hooker/handler/poller/EventStockErrorHandler.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
src/main/java/com/rbkmoney/hooker/handler/poller/PollingEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
package com.rbkmoney.hooker.handler.poller; | ||
|
||
import com.rbkmoney.damsel.event_stock.StockEvent; | ||
import com.rbkmoney.damsel.payment_processing.InvoiceChange; | ||
import com.rbkmoney.hooker.handler.Handler; | ||
import com.rbkmoney.thrift.filter.Filter; | ||
|
||
public interface PollingEventHandler<T> extends Handler<T> { | ||
default boolean accept(T value) { | ||
return getFilter().match(value); | ||
} | ||
public interface PollingEventHandler extends Handler<InvoiceChange, StockEvent> { | ||
|
||
Filter getFilter(); | ||
} |
24 changes: 0 additions & 24 deletions
24
src/main/java/com/rbkmoney/hooker/handler/poller/impl/AbstractEventHandler.java
This file was deleted.
Oops, something went wrong.
16 changes: 15 additions & 1 deletion
16
src/main/java/com/rbkmoney/hooker/handler/poller/impl/AbstractInvoiceEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
package com.rbkmoney.hooker.handler.poller.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.hooker.dao.DaoException; | ||
import com.rbkmoney.hooker.handler.poller.PollingEventHandler; | ||
|
||
/** | ||
* Created by inalarsanukaev on 07.04.17. | ||
*/ | ||
public abstract class AbstractInvoiceEventHandler extends AbstractEventHandler{ | ||
public abstract class AbstractInvoiceEventHandler implements PollingEventHandler { | ||
|
||
public static final String INVOICE = "invoice"; | ||
public static final String PAYMENT = "payment"; | ||
|
||
@Override | ||
public void handle(InvoiceChange ic, StockEvent value){ | ||
Event event = value.getSourceEvent().getProcessingEvent(); | ||
saveEvent(ic, event); | ||
} | ||
|
||
protected abstract void saveEvent(InvoiceChange ic, Event event) throws DaoException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.