Doing serialization in same thread as publish