[jboss-dev-forums] [Design of JBoss Portal] - Persistent producer registration impl

julien@jboss.com do-not-reply at jboss.com
Sun Dec 10 10:44:32 EST 2006


I am starting to implementation of the producer registration in the core module based on hibernate.

I don't understand the logic in RegistrationManagerImpl#createConsumer(String name) and RegistrationManagerImpl #addConsumerToGroupNamed(String consumerName, String groupName, ...)

In createConsumer:
1/ a consumer is created
2/ its name is used to to retrieve a group

then the created consumer is never used anymore.

I see that the method is calling public Consumer addConsumerToGroupNamed(String consumerName, String groupName, boolean createGroupIfNeeded, boolean createConsumerIfNeeded) with 

 addConsumerToGroupNamed(groupName, groupName, true, false);

I have a few comments on that :

1/ perhaps it should be consumer.getName() as first argument
2/ is the method addConsumerToGroupNamed able to retrieve the same consumer from only its name and not its id, or do we have an effective dual creation of a consumer ?


  | String identity = policy.getConsumerIdFrom(consumerName, Collections.EMPTY_MAP));
  | 

I would have rather simply seen :

 addConsumerToGroupNamed(consumer, groupName, true, false);

I would go even further by adding that constraint in the persistence manager and instead of having the sequence :

1/ create consumer
2/ associate it with a consumer group

change Consumer createConsumer(String id, String name) throws RegistrationException;

to Consumer createConsumer(ConsumerGroup consumerGroup, String id, String name) throws RegistrationException; to enforce by construction the fact that a consumer is attached to a group.




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992545#3992545

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992545



More information about the jboss-dev-forums mailing list