You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Mohan Radhakrishnan <ra...@gmail.com> on 2014/12/12 06:59:26 UTC
Java Enum in wiring bolts
Hi,
It should be possible to use a Java Enum instead of the string in this
code to prevent it from compiling if the type-safety is violated. So if "X"
doesn't exist it shouldn't fail during runtime.
That should be possible. Right ?
builder.setSpout("X", tweetSpout, 1);
builder.setBolt("Y", new Bolt(), 10).shuffleGrouping("X");
builder.setBolt("Z", new Bolt1(), 15).fieldsGrouping("Y", new
Fields("word"));
Thanks,
Mohan
Re: Java Enum in wiring bolts
Posted by Mohan Radhakrishnan <ra...@gmail.com>.
Yes. I thought the newer API might use Enum which is limited to the
compilation feature. I understand the logic is a different problem.
Thanks.
On Fri, Dec 12, 2014 at 11:35 AM, Nathan Leung <nc...@gmail.com> wrote:
>
> This doesn't fully fix the problem. What if your enumeration has W, X, Y,
> Z, and Bolt Y subscribes from W which has not been "set" as either a spout
> or a bolt? You end up with the exact same problem.
>
> On Fri, Dec 12, 2014 at 12:59 AM, Mohan Radhakrishnan <
> radhakrishnan.mohan@gmail.com> wrote:
>
>>
>> Hi,
>>
>> It should be possible to use a Java Enum instead of the string in this
>> code to prevent it from compiling if the type-safety is violated. So if "X"
>> doesn't exist it shouldn't fail during runtime.
>>
>> That should be possible. Right ?
>>
>> builder.setSpout("X", tweetSpout, 1);
>> builder.setBolt("Y", new Bolt(), 10).shuffleGrouping("X");
>>
>> builder.setBolt("Z", new Bolt1(), 15).fieldsGrouping("Y", new
>> Fields("word"));
>>
>> Thanks,
>> Mohan
>>
>
>
Re: Java Enum in wiring bolts
Posted by Nathan Leung <nc...@gmail.com>.
This doesn't fully fix the problem. What if your enumeration has W, X, Y,
Z, and Bolt Y subscribes from W which has not been "set" as either a spout
or a bolt? You end up with the exact same problem.
On Fri, Dec 12, 2014 at 12:59 AM, Mohan Radhakrishnan <
radhakrishnan.mohan@gmail.com> wrote:
>
> Hi,
>
> It should be possible to use a Java Enum instead of the string in this
> code to prevent it from compiling if the type-safety is violated. So if "X"
> doesn't exist it shouldn't fail during runtime.
>
> That should be possible. Right ?
>
> builder.setSpout("X", tweetSpout, 1);
> builder.setBolt("Y", new Bolt(), 10).shuffleGrouping("X");
>
> builder.setBolt("Z", new Bolt1(), 15).fieldsGrouping("Y", new
> Fields("word"));
>
> Thanks,
> Mohan
>