-
Notifications
You must be signed in to change notification settings - Fork 146
/
EventHubBinding.java
54 lines (41 loc) · 1.66 KB
/
EventHubBinding.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.maven.function.bindings;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.microsoft.azure.serverless.functions.annotation.EventHubOutput;
import com.microsoft.azure.serverless.functions.annotation.EventHubTrigger;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class EventHubBinding extends BaseBinding {
public static final String EVENT_HUB_TRIGGER = "eventHubTrigger";
public static final String EVENT_HUB = "eventHub";
private String eventHubName = "";
private String consumerGroup = "";
private String connection = "";
public EventHubBinding(final EventHubTrigger eventHubTrigger) {
super(eventHubTrigger.name(), EVENT_HUB_TRIGGER, Direction.IN, eventHubTrigger.dataType());
eventHubName = eventHubTrigger.eventHubName();
consumerGroup = eventHubTrigger.consumerGroup();
connection = eventHubTrigger.connection();
}
public EventHubBinding(final EventHubOutput eventHubOutput) {
super(eventHubOutput.name(), EVENT_HUB, Direction.OUT, eventHubOutput.dataType());
eventHubName = eventHubOutput.eventHubName();
connection = eventHubOutput.connection();
}
@JsonGetter("path")
public String getEventHubName() {
return eventHubName;
}
@JsonGetter
public String getConsumerGroup() {
return consumerGroup;
}
@JsonGetter
public String getConnection() {
return connection;
}
}