Results 1 to 5 of 5

Thread: Claim check out calls getMessage twice (for some implementations)

  1. #1

    Default Claim check out calls getMessage twice (for some implementations)

    Hi there,

    I'm wondering if there is any reason why the ClaimCheckOutTransformer uses MessageStore.getMessage instead of MessageStore.removeMessage to retrieve the row? MessageStore.removeMessage is supposed to return the message as well.

    It ends up, for JdbcMessageStore anyways, retrieving the row twice (and performing the row mapping twice). For large payloads, this deserialization might take some time.

    Instead of:
    Code:
    	Message<?> retrievedMessage = this.messageStore.getMessage(id);
    	Assert.notNull(retrievedMessage, "unable to locate Message for ID: " + id
    			+ " within MessageStore [" + this.messageStore + "]");
    	if (this.removeMessage) {
    		this.messageStore.removeMessage(id);
    		if (logger.isDebugEnabled()) {
    			logger.debug("Removed Message with claim-check '" + id + "' from the MessageStore.");
    		}
    	}
    Couldn't it be:
    Code:
    	Message<?> retrievedMessage;
    	if (this.removeMessage) {
    		retrievedMessage = this.messageStore.removeMessage(id);
    		if (logger.isDebugEnabled()) {
    			logger.debug("Removed Message with claim-check '" + id + "' from the MessageStore.");
    		}
    	}
    	else {
    		retrievedMessage = this.messageStore.getMessage(id);
    	}
    	Assert.notNull(retrievedMessage, "unable to locate Message for ID: " + id
    			+ " within MessageStore [" + this.messageStore + "]")

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Seems like a good suggestion to me. Would you mind creating a JIRA "improvement" issue?... and if you're interested, you could even submit a Pull Request for that issue (after signing the CLA here if you have not done so earlier: https://support.springsource.com/spr...mmitter_signup).

    Thanks!
    -Mark

  3. #3
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    By the way, one thing I do notice is that the current behavior would always throw an Exception if the item is NULL (due to the Assert.notNull), so in your suggested change, that behavior would need to be accounted for by asserting against the object returned from the remove call.

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Nevermind, you have it at the end. I should read the whole thing before commenting next time

    Cheers,
    Mark

  5. #5

    Default

    Great, I did all of those things you suggested.

    https://jira.springsource.org/browse/INT-2920
    https://github.com/SpringSource/spri...ation/pull/736

    Happy to help!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •