I have an application that consumes messages from beanstalkd. You cannot pass context to beanstalkd and you can only use byte slice to send messages. So I converted my context to byte slice.
To propagate from passed context it needs to be converted to context.Context. Is this possible?
// Sending context
ctx := context.Background()
reqBodyBytes := new(bytes.Buffer)
json.NewEncoder(reqBodyBytes).Encode(ctx)
_, err = conn.Put(reqBodyBytes.Bytes(), 1, 0, 120*time.Second)
// Consuming context
_, body, err := conn.Reserve(120 * time.Second)
fmt.Println(string(body))