Skip to content

Commit

Permalink
FABJ-399 Remove eventhub code
Browse files Browse the repository at this point in the history
Change-Id: Id7086a1e0223a6dff60e97f577a381a1705f4b40
Signed-off-by: rickr <cr22rc@gmail.com>
  • Loading branch information
cr22rc committed Jan 22, 2019
1 parent 2080902 commit d2bc6d5
Show file tree
Hide file tree
Showing 40 changed files with 326 additions and 1,430 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,14 @@ No.
### Firewalls, load balancers, network proxies

These can sometimes silently kill a network connections and prevent them from auto reconnecting. To fix this look at
adding to Peers, EventHub's and Orderer's connection properties:
adding to Peers and Orderer's connection properties:
`grpc.NettyChannelBuilderOption.keepAliveTime`, `grpc.NettyChannelBuilderOption.keepAliveTimeout`,
`grpc.NettyChannelBuilderOption.keepAliveWithoutCalls`. Examples of this are in End2endIT.java

### grpc message frame size exceeds maximum

The message being returned from the fabric server is too large for the default grpc frame size.
On the Peer, Orderer, orEventHub add the property `grpc.NettyChannelBuilderOption.maxInboundMessageSize`
On the Peer or Orderer add the property `grpc.NettyChannelBuilderOption.maxInboundMessageSize`
See [End2endIT's constructChannel](https://github.com/hyperledger/fabric-sdk-java/blob/b649868113e969d851720c972f660114b64247bc/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L846)


Expand Down
4 changes: 0 additions & 4 deletions config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
#org.hyperledger.fabric.sdk.orderer_retry.wait_time=200
## The time the peer event registration waits for first failure in ms
#org.hyperledger.fabric.sdk.peer.eventRegistration.wait_time=5000
## The time the event hub waits to reconnect in ms
#EVENTHUB_CONNECTION_WAIT_TIME=5000
## The number of unsuccessful attempts by the eventhub to reconnect before another warning is issued. Set to -1 for none.
#EVENTHUB_RECONNECTION_WARNING_RATE=50
## The number of unsuccessful attempts by the peer eventing service to reconnect before another warning is issued. Set to -1 for none.
#PEER_EVENT_RECONNECTION_WARNING_RATE=50
## The time the peer eventing service wait to retry to connect in ms.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<version>0.6.1</version>
<configuration>
<!--
The version of protoc must match protobuf-java. If you don't depend on
Expand Down
65 changes: 2 additions & 63 deletions src/main/java/org/hyperledger/fabric/sdk/BlockEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.protobuf.InvalidProtocolBufferException;
import org.hyperledger.fabric.protos.common.Common.Block;
import org.hyperledger.fabric.protos.peer.PeerEvents;
import org.hyperledger.fabric.protos.peer.PeerEvents.Event;
import org.hyperledger.fabric.sdk.exception.InvalidProtocolBufferRuntimeException;

/**
Expand All @@ -29,70 +28,22 @@
* @see Block
*/
public class BlockEvent extends BlockInfo {
// private static final Log logger = LogFactory.getLog(BlockEvent.class);

private final EventHub eventHub;
private final Peer peer;
private final Event event;

/**
* creates a BlockEvent object by parsing the input Block and retrieving its constituent Transactions
*
* @param eventHub a Hyperledger Fabric Block message
* @throws InvalidProtocolBufferException
* @see Block
*/
BlockEvent(EventHub eventHub, Event event) throws InvalidProtocolBufferException {
super(event.getBlock());
this.eventHub = eventHub;
this.peer = null;
this.event = event;
}

BlockEvent(Peer peer, PeerEvents.DeliverResponse resp) {
super(resp);
eventHub = null;
this.peer = peer;
this.event = null;

}

/**
* Get the Event Hub that received the event.
*
* @return an Event Hub. Maybe null if new peer eventing services is being used.
* @deprecated Use new peer eventing services
*/
public EventHub getEventHub() {
return eventHub;
}

/**
* The Peer that received this event.
*
* @return Peer that received this event. Maybe null if source is legacy event hub.
* @return Peer that received this event
*/
public Peer getPeer() {
return peer;
}

// /**
// * Raw proto buff event.
// *
// * @return Return raw protobuf event.
// */
//
// public Event getEvent() {
// return event;
// }

boolean isBlockEvent() {
if (peer != null) {
return true; //peer always returns Block type events;
}

return event != null && event.getEventCase() == PeerEvents.Event.EventCase.BLOCK;
}

TransactionEvent getTransactionEvent(int index) throws InvalidProtocolBufferException {
TransactionEvent ret = null;
Expand Down Expand Up @@ -130,22 +81,10 @@ public BlockEvent getBlockEvent() {

}

/**
* The event hub that received this event.
*
* @return May return null if peer eventing service detected the event.
* @deprecated use new peer eventing services {@link #getPeer()}
*/

public EventHub getEventHub() {

return BlockEvent.this.getEventHub();
}

/**
* The peer that received this event.
*
* @return May return null if deprecated eventhubs are still being used, otherwise return the peer.
* @return return peer producing the event.
*/

public Peer getPeer() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/hyperledger/fabric/sdk/BlockInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,8 @@ public String getChaincodeIDVersion() {
}

/**
* Get read write set for this transaction. Will return null on for Eventhub events.
* For eventhub events find the block by block number to get read write set if needed.
* Get read write set for this transaction. Will return null on for peer events.
* For peer events find the block by block number to get read write set if needed.
*
* @return Read write set.
*/
Expand Down
Loading

0 comments on commit d2bc6d5

Please sign in to comment.