Package org.hyperledger.fabric.sdk
Class EventHub
- java.lang.Object
-
- org.hyperledger.fabric.sdk.EventHub
-
- All Implemented Interfaces:
java.io.Serializable
public class EventHub extends java.lang.Object implements java.io.Serializable
Class to manage fabric events.Feeds Channel event queues with events
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
EventHub.EventHubDisconnected
Eventhub disconnection notification interface
-
Field Summary
Fields Modifier and Type Field Description protected EventHub.EventHubDisconnected
disconnectedHandler
Default reconnect event hub implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
long
getConnectedTime()
Get last connect time.long
getDisconnectedTime()
Get disconnected time.long
getLastConnectedAttempt()
Get last attempt time to connect the event hub.java.lang.String
getName()
Event hub namejava.util.Properties
getProperties()
Event hub propertiesjava.lang.String
getUrl()
Get the GRPC URL used to connect.boolean
isConnected()
Is event hub connected.EventHub.EventHubDisconnected
setEventHubDisconnectedHandler(EventHub.EventHubDisconnected newEventHubDisconnectedHandler)
Set class to handle Event hub disconnectsvoid
shutdown()
java.lang.String
toString()
-
-
-
Field Detail
-
disconnectedHandler
protected transient EventHub.EventHubDisconnected disconnectedHandler
Default reconnect event hub implementation. Applications are free to replace
-
-
Method Detail
-
getDisconnectedTime
public long getDisconnectedTime()
Get disconnected time.- Returns:
- Time in milli seconds disconnect occurred. Zero if never disconnected
-
isConnected
public boolean isConnected()
Is event hub connected.- Returns:
- boolean if true event hub is connected.
-
getConnectedTime
public long getConnectedTime()
Get last connect time.- Returns:
- Time in milli seconds the event hub last connected. Zero if never connected.
-
getLastConnectedAttempt
public long getLastConnectedAttempt()
Get last attempt time to connect the event hub.- Returns:
- Last attempt time to connect the event hub in milli seconds. Zero when never attempted.
-
getName
public java.lang.String getName()
Event hub name- Returns:
- event hub name
-
getProperties
public java.util.Properties getProperties()
Event hub properties- Returns:
- Event hub properties
- See Also:
HFClient.newEventHub(String, String, Properties)
-
getUrl
public java.lang.String getUrl()
Get the GRPC URL used to connect.- Returns:
- GRPC URL.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
shutdown
public void shutdown()
-
setEventHubDisconnectedHandler
public EventHub.EventHubDisconnected setEventHubDisconnectedHandler(EventHub.EventHubDisconnected newEventHubDisconnectedHandler)
Set class to handle Event hub disconnects- Parameters:
newEventHubDisconnectedHandler
- New handler to replace. If set to null no retry will take place.- Returns:
- the old handler.
-
finalize
public void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-