Skip to content

Commit 0124c5d

Browse files
committed
migrate PipelineBridge to interface pattern
1 parent f92b6d6 commit 0124c5d

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

libs/logstash-bridge/src/main/java/org/elasticsearch/logstashbridge/ingest/PipelineBridge.java

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@
1919
/**
2020
* An external bridge for {@link Pipeline}
2121
*/
22-
public class PipelineBridge extends StableBridgeAPI.ProxyInternal<Pipeline> {
23-
public static PipelineBridge fromInternal(final Pipeline pipeline) {
24-
return new PipelineBridge(pipeline);
22+
public interface PipelineBridge extends StableBridgeAPI<Pipeline> {
23+
24+
String getId();
25+
26+
void execute(IngestDocumentBridge bridgedIngestDocument, BiConsumer<IngestDocumentBridge, Exception> bridgedHandler);
27+
28+
static PipelineBridge fromInternal(final Pipeline pipeline) {
29+
return new ProxyInternal(pipeline);
2530
}
2631

27-
public static PipelineBridge create(
32+
static PipelineBridge create(
2833
String id,
2934
Map<String, Object> config,
3035
Map<String, ProcessorBridge.Factory> processorFactories,
@@ -41,18 +46,23 @@ public static PipelineBridge create(
4146
);
4247
}
4348

44-
public PipelineBridge(final Pipeline delegate) {
45-
super(delegate);
46-
}
49+
class ProxyInternal extends StableBridgeAPI.ProxyInternal<Pipeline> implements PipelineBridge {
4750

48-
public String getId() {
49-
return internalDelegate.getId();
50-
}
51+
public ProxyInternal(final Pipeline delegate) {
52+
super(delegate);
53+
}
5154

52-
public void execute(final IngestDocumentBridge ingestDocumentBridge, final BiConsumer<IngestDocumentBridge, Exception> handler) {
53-
this.internalDelegate.execute(
54-
StableBridgeAPI.toInternalNullable(ingestDocumentBridge),
55-
(ingestDocument, e) -> handler.accept(IngestDocumentBridge.fromInternalNullable(ingestDocument), e)
56-
);
55+
@Override
56+
public String getId() {
57+
return internalDelegate.getId();
58+
}
59+
60+
@Override
61+
public void execute(final IngestDocumentBridge ingestDocumentBridge, final BiConsumer<IngestDocumentBridge, Exception> handler) {
62+
this.internalDelegate.execute(
63+
StableBridgeAPI.toInternalNullable(ingestDocumentBridge),
64+
(ingestDocument, e) -> handler.accept(IngestDocumentBridge.fromInternalNullable(ingestDocument), e)
65+
);
66+
}
5767
}
5868
}

0 commit comments

Comments
 (0)