Announcement Announcement Module
Collapse
No announcement yet.
optional id generator in place of java.util.UUID in MessageHeaders Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • optional id generator in place of java.util.UUID in MessageHeaders

    Within Spring Integration, is it possible to wire up an alternate Id Generator class with MessageHeaders instead of it defaulting to java.util.UUID.randomUUID() for message Id? It looks like there is provisioning for that in the MessageHeaders code but it's a private instance variable, I'm not sure how that would be config'd? The jre's UUID is slow as it dips down to os to generate secure random numbers which in my case is more robust than I need/want for uuids, a simple mac address/time variant based UUID would be something I'd like to substitute. The jre UUID ends up in a thread synch, which when running multiple consumer threads in a DefaultMessageListenerContainer, nips at overall throughput, I'm routinely seeing consumer threads go into BLOCK state in jconsole thread view pane:

    Name: mythreadid_1
    State: BLOCKED on java.security.SecureRandom@f684d9 owned by: mythreadid_2
    Total blocked: 122,272 Total waited: 175,808

    Stack trace:
    java.security.SecureRandom.nextBytes(SecureRandom. java:433)
    java.util.UUID.randomUUID(UUID.java:162)
    org.springframework.integration.MessageHeaders.<in it>(MessageHeaders.java:96)
    org.springframework.integration.message.GenericMes sage.<init>(GenericMessage.java:68)
    org.springframework.integration.support.MessageBui lder.build(MessageBuilder.java:298)
    org.springframework.integration.history.MessageHis tory.write(MessageHistory.java:68)
    org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:149)
    org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:12

  • #2
    Yes, its a new undocumented feature that was introduced since 2.0.4. Look at this JIRA and let me know if you need more info: https://jira.springsource.org/browse/INT-1903

    Comment


    • #3
      Also, since you are looking for timebased UUID check out this code https://github.com/olegz/uuid.

      Comment


      • #4
        Feel free to open a JIRA issue to have this documented. We originally introduced it quietly, but it seems like it might be a popular feature if we draw more attention to it.

        Thanks,
        Mark

        Comment


        • #5
          cool, thanks for this info, it's exactly what I was looking for! I will try to file that jira for docs.

          Comment

          Working...
          X