Announcement Announcement Module
Collapse
No announcement yet.
DelayHander with MessageGroupStore Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DelayHander with MessageGroupStore

    When using a delayer, the DelayHandler uses a MessageGroupStore zu delay its messages.

    Code:
    	private volatile MessageGroupStore messageStore;

    but the onInit method checks agaist MessageStore

    Code:
    	protected void onInit() {
    		super.onInit();
    		if (this.messageStore == null) {
    			this.messageStore = new SimpleMessageStore();
    		}
    		else {
    			Assert.isInstanceOf(MessageStore.class, this.messageStore);
    		}
    
    		this.releaseHandler = this.createReleaseMessageTask();
    	}
    intentional or a bug?

    br, Steve

  • #2
    MessageStore and MessageGroupStore are disjoint, unrelated, interfaces.

    All the framework message stores implement both interfaces.

    The DelayHandler needs a MessageGroupStore that's also a MessageStore.

    Hence the need for the assertion.

    Comment


    • #3
      You say "DelayHandler needs a MessageGroupStore that's also a MessageStore", but when I look into
      the code there is only one section, where the GroupMessageStore is used as MessageStore in the
      doReleaseMessage method:
      Code:
      	private void doReleaseMessage(Message<?> message) {
      		if (this.messageStore instanceof SimpleMessageStore
      				|| ((MessageStore) this.messageStore).removeMessage(message.getHeaders().getId()) != null) {
      			this.messageStore.removeMessageFromGroup(this.messageGroupId, message);
      			this.handleMessageInternal(message);
      		}
      		else {
      			if (logger.isDebugEnabled()) {
      				logger.debug("No message in the Message Store to release: " + message +
      						". Likely another instance has already released it.");
      			}
      		}
      	}
      but the instanceof check is against SimpleMessageStore, not MessageStore, so any GroupMessageStore implementation, that also is a MessageStore will still not work.

      br, Steve

      Comment


      • #4
        No - the test says: IF it's a SimpleMessageStore OR removing the message from the group store (when cast to a MessageStore) is successful THEN remove the message from the group.

        However, this looks wrong to me because it means for SimpleMessageGroups, removeMessage() is not called (just removeMessageFromGroup()), but I may be missing something.

        I'll try to look at it some more over the weekend and/or talk to the author when he's back next week.

        Comment


        • #5
          It turns out that the remove is not needed for a SimpleMessageStore because, internally, the SMS maintains its store Vs. group store functions independently. Whereas the JDBC message store does not.

          We agree this store Vs. group store area is a little messy; we have an open JIRA issue to clean it up https://jira.springsource.org/browse/INT-2673.

          Comment

          Working...
          X