Hi mongonix,
I placed comments inline.
On Apr 26, 3:46 pm, mongonix <
romix...@gmail.com> wrote:
> Hi Peter,
>
> Very nice project!
Thank you.
>
> I have a small remark:
>
> > @Partitioned
> > void fire(@RoutingId String id);
>
> I'd suggest that you also support the case, where one of the passed
> parameters is implementing PartitionAware interface. In such a case, you
> can simply use its PartitionAware.getParitionKey() to get the partition id.
I can do that.
It needs some cleanup anyway. Sometimes you have a composed object and
you don't want to use the hash of the object itself, but have a bit
more control.
With open spaced you can say:
void hire(@RoutingId(property = "employeeId") Employee e){....}
void fire(@RoutingId employeeId){...}
The example is bogus, but it shows that want to have different types
of objects, using the same routing. In the first example, the hash of
the employee isn't used, but the field 'employeeId'.
But the same thing can be reached by letting the Employee implement
the PartitionAware interface so that it returns the employeeId as
partition key, but you don't always have ownership of
the objects (so you can't always add an additional interface).
But I agree, there is certainly room for improvement. I'll add it as a
feature for 0.1.
>
> I.e. you get something like:
>
> @Partitioned
> void fire(@PartitionAwareId PartitionAwareDerived partAwareObj, other
> params);
>
> I'm not sure about the @PartitionAwareId annotation. May be it is not
> needed at all, as you can just check the type of a parameter and see if it
> implements the PartitionAware interface.
>
> What do you think?
In this case it can be inferred.
Personally I do like to have it explicit. If you don't add an
annotation,
you need to look at the parameter classes to figure out which argument
is
responsible for the routing.
And... code changes over time.. what if another arguments later also
starts
to implement the routing aware.. then the assumption that argument x
was
responsible, secretly gets violated because argument y becomes
responsible.
> -Leo
what do you think?