jennings/Turbocharged.Beanstalk

Built-in serialization of objects rather than byte arrays

jennings opened this issue · 1 comments

I imagine most .NET consumers actually want to store objects, not byte arrays, in Beanstalk. We could expose PutAsync<T> and ReserveAsync<T> methods that serialize the objects:

string str = "hello";
await producer.PutAsync<string>(str, 1, 0, 1);
var result = await consumer.ReserveAsync<string>();
// result.Object == "hello"

Questions:

  • What if we can't deserialize the object, if somebody put something weird in the tube? Do we bury the message? Return it as a Job but with a null .Object property? Throw an exception?

added in eb51e32