amenzhinsky / iothub

Azure IoT Hub SDK for Golang
MIT License
51 stars 57 forks source link

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

Open PremSahooESL opened 11 months ago

PremSahooESL commented 11 months ago

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 commented 11 months ago

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

PremSahooESL commented 11 months ago

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 commented 11 months ago

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

Thanks in advance.

amenzhinsky commented 11 months ago

Could you try updating to @master?

PremSahooESL commented 11 months ago

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 commented 11 months ago

Is the iotservice client tested to send C2D message?

den19980107 commented 2 months ago

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!