gostorm icon indicating copy to clipboard operation
gostorm copied to clipboard

Bolts that accept multiple streams cannot differentiate expected fields

Open cameront opened this issue 10 years ago • 3 comments

either Fields() needs to take a string that can help decide which interfaces get returned, or a new method FieldsForStream(string)? needs to be added to the interface that allows the bolt to return fields dependent on the streamId passed.

cameront avatar Jun 05 '14 00:06 cameront

I think both changes would break existing users, unless a new "MultiStreamBolt" interface is created, which seems unideal?

cameront avatar Jun 05 '14 01:06 cameront

Yes, this is a gap we saw when we added the ShellBolt and ShellSpout wrappers for the conn objects. I would prefer to just take the pain now and break the interface. Maybe this is a good time to start versioning GoStorm. In the release notes for the new version we can specify the breaking change and we can add a section to the readme to tell the user to use the gofmt tool to help fix the breaking changes with something like: gofmt -r 'func Fields() -> func Fields("default")' -w *.go. Of course I'm still not entirely happy with how Fields works.

jsgilmore avatar Jun 20 '14 02:06 jsgilmore

We'll also have to rethink how the ShellBolt handles its connection. Currently it requests fields from the fields factory and then reads the metadata and fields from the connection. We now need to first read the metadata, maybe buffer the fields bytes, Use the metadata to obtain the correct fields objects and then use the conn again to correctly unmarshall the fields. We need to think on whether we can't find a more elegant solution here.

jsgilmore avatar Jun 20 '14 03:06 jsgilmore