We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connection should be reused instead of creating a new connection in every send causing
i have verifed with below changes
type EvenHubConn struct { mu sync.Mutex ep Endpoint conn *eventhub.Hub } func (conn *EvenHubConn) close() { if conn.conn != nil { conn.conn.Close(context.Background()) conn.conn = nil } } // Send sends a message func (conn *EvenHubConn) Send(msg string) error { conn.mu.Lock() defer conn.mu.Unlock() if conn.conn == nil { hub, err := eventhub.NewHubFromConnectionString(conn.ep.EventHub.ConnectionString) if err != nil { return err } conn.conn = hub } ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) defer cancel() // parse json again to get out info for our kafka key key := gjson.Get(msg, "key") id := gjson.Get(msg, "id") keyValue := fmt.Sprintf("%s-%s", key.String(), id.String()) evtHubMsg := eventhub.NewEventFromString(msg) evtHubMsg.PartitionKey = &keyValue err := conn.conn.Send(ctx, evtHubMsg) if err != nil { conn.close() return err } return nil }
The text was updated successfully, but these errors were encountered:
Hey @lokisisland, do you think you can take a look at this? :)
Sorry, something went wrong.
No branches or pull requests
connection should be reused instead of creating a new connection in every send
causing
i have verifed with below changes
The text was updated successfully, but these errors were encountered: