spring-projects / spring-integration-extensions

The Spring Integration Extensions project provides extension components for Spring Integration
http://www.springintegration.org/
284 stars 266 forks source link

HazelcastMessageStore should use keySet instead of values #248

Closed BenjaminHutchinson closed 3 years ago

BenjaminHutchinson commented 3 years ago

Expected Behavior

The 'doListKeys' method in HazelcastMessageStore should return a list of keys within the message store that match the pattern

Current Behavior The method currently returns the full value object, which causes a classcastexception down the line.

Context

I believe the method should internally be calling keySet on line 82, instead of values.

image

image

Caused by: java.lang.ClassCastException: class org.springframework.integration.store.MessageGroupMetadata cannot be cast to class java.lang.String (org.springframework.integration.store.MessageGroupMetadata is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap') at org.springframework.integration.store.AbstractKeyValueMessageStore.normalizeKeys(AbstractKeyValueMessageStore.java:361) ~[spring-integration-core-5.4.6.jar:5.4.6] at org.springframework.integration.store.AbstractKeyValueMessageStore.iterator(AbstractKeyValueMessageStore.java:352) ~[spring-integration-core-5.4.6.jar:5.4.6] at org.springframework.integration.store.AbstractMessageGroupStore.expireMessageGroups(AbstractMessageGroupStore.java:128) ~[spring-integration-core-5.4.6.jar:5.4.6]

artembilan commented 3 years ago

Thank you @BenjaminHutchinson , for reporting this! I have just pushed the fix. Our mistake was not having a test coverage for that functionality.

Looking forward for more contribution from you!

artembilan commented 3 years ago

Here is a SNAPSHOT with the fix: https://repo.spring.io/libs-snapshot-local/org/springframework/integration/spring-integration-hazelcast/3.0.1-SNAPSHOT/spring-integration-hazelcast-3.0.1-SNAPSHOT.jar.

Let us know and we can that 3.0.1 since we have a couple more fixes over there.

BenjaminHutchinson commented 3 years ago

Cheers for the quick fix, I've begun using the library in a project I'm working on so I'll be able to pass along any feedback that comes from that as well.