iothub icon indicating copy to clipboard operation
iothub copied to clipboard

latest code of iotservice client is not working. It uses wrong version of amqp lib functions.

Open PremSahooESL opened this issue 2 years ago • 7 comments

Application could not get started due to wrong method signture being used from eventhub package. I am trying to use iotservice client on my application. I end up gettng below error.

image

PremSahooESL avatar Jul 25 '23 11:07 PremSahooESL

Looks as if latest code does not use amqp 1.0.1 Lib.

PremSahooESL avatar Jul 25 '23 11:07 PremSahooESL

Some how I managed to use old iotservice client code. but no luck. I am getting below error continuously wile using SendEvent() for sending C2D message.

Error: protocol error: received flow without next-incoming-id after session established

IoTHubClient, connectionErr := iotservice.NewFromConnectionString(SERVICE_CONNECTION_STRING)
	if connectionErr != nil {
		logger.Error(connectionErr)
	}
	ctx, cancel := context.WithTimeout(context.Background(), DEFAULT_CONTEXT_TIMEOUT_SEC*time.Second)
	defer cancel()

sendError := IoTHubClient.SendEvent(ctx, DEVICE_ID, payload,
			iotservice.WithSendProperties(msgProperties),
			iotservice.WithSendAck(iotservice.AckPositive),
			iotservice.WithSendUserID("Go lang Iot Service Client"),
			iotservice.WithSendMessageID(id.String()))

if sendError != nil {
			logger.Error("Error occurred while sending C-2-D message for device: ", DEVICE_ID, ", Error: ", sendError)
}

PremSahooESL avatar Jul 25 '23 11:07 PremSahooESL

Could you please help me on this? Its quite urgent.

Thanks in advance.

PremSahooESL avatar Jul 25 '23 11:07 PremSahooESL

Could you try updating to @master?

amenzhinsky avatar Jul 25 '23 11:07 amenzhinsky

Doing above solved the application startup error. Now application is getting started. But while sending C2D message it throws same error.

### protocol error: received flow without next-incoming-id after session established

PremSahooESL avatar Jul 25 '23 11:07 PremSahooESL

Is the iotservice client tested to send C2D message?

PremSahooESL avatar Jul 25 '23 12:07 PremSahooESL

Could you try updating to @master?

@amenzhinsky Can you add a new tag to the latest commit that solves the amqp library issue instead of using @master to the go mod file?

Thanks for maintaining this library!

den19980107 avatar Apr 25 '24 01:04 den19980107