private Task <T> CreateMessageAndListen <T>( MessageMethod method, ChaincodeMessage.Types.Type type, IMessage payload, string channelId, string txId ) { return(AskPeerAndListen <T>(CreateMessage(type, payload, channelId, txId), method)); }
private static ChaincodeMessage NewEventMessage(ChaincodeMessage.Types.Type type, string channelId, string txId, ByteString payload, ChaincodeEvent evnt) { ChaincodeMessage msg = new ChaincodeMessage { Type = type, ChannelId = channelId, Txid = txId, Payload = payload }; if (evnt != null) { msg.ChaincodeEvent = evnt; } return(msg); }
private ChaincodeMessage CreateMessage( ChaincodeMessage.Types.Type type, IMessage payload, string channelId, string txId ) { return(new ChaincodeMessage { Type = type, Payload = payload.ToByteString(), Txid = txId, ChannelId = channelId }); }
CreateValidHandlerWithMessageQueueExpectation( MessageMethod messageMethod, ChaincodeMessage.Types.Type type ) { var messageQueueMock = new Mock <IMessageQueue>(); messageQueueMock.Setup(m => m.QueueMessage(It.Is( (QueueMessage message) => message.Method == messageMethod && message.Message.Type == type ))); var messageQueueFactoryMock = new Mock <IMessageQueueFactory>(); messageQueueFactoryMock.Setup(m => m.Create(It.IsAny <IHandler>())) .Returns(messageQueueMock.Object); return(CreateHandlerWithChainsupportClientFactory(messageQueueFactoryMock.Object), messageQueueMock); }
private static ChaincodeMessage NewEventMessage(ChaincodeMessage.Types.Type type, string channelId, string txId, ByteString payload) { return(NewEventMessage(type, channelId, txId, payload, null)); }
private async Task <QueryResponse> InvokeQueryResponseMessageAsync(string channelId, string txId, ChaincodeMessage.Types.Type type, ByteString payload, CancellationToken token) { try { return(QueryResponse.Parser.ParseFrom(await InvokeChaincodeSupportAsync(NewEventMessage(type, channelId, txId, payload), token).ConfigureAwait(false))); } catch (Exception e) { logger.Error($"[{txId,-8}s] unmarshall error"); throw new InvalidOperationException("Error unmarshalling QueryResponse.", e); } }