This commit is contained in:
parent
e44435b54d
commit
b70683d765
2 changed files with 11 additions and 6 deletions
|
|
@ -28,6 +28,7 @@ public class ImdgHazelcast<T extends SpcexObjectBase> implements Imdg<T> {
|
|||
|
||||
@Override
|
||||
public void insert(T paramT) {
|
||||
map.put(idGenerator.newId(), paramT);
|
||||
paramT.setId(idGenerator.newId());
|
||||
map.put(paramT.getId(), paramT);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,11 +39,15 @@ public class QueueConsumer implements AutoCloseable {
|
|||
try {
|
||||
consumer.subscribe(callbacks.keySet());
|
||||
while (!closed.get()) {
|
||||
ConsumerRecords<String, Object> records = consumer.poll(Duration.of(10, ChronoUnit.SECONDS));
|
||||
for (ConsumerRecord<String, Object> next : records) {
|
||||
ConsumerSpecificClass<?> callback = callbacks.get(next.topic());
|
||||
Object o = json.readValue((String) next.value(), callback.getClazz());
|
||||
callback.acceptRaw(o);
|
||||
try {
|
||||
ConsumerRecords<String, Object> records = consumer.poll(Duration.of(10, ChronoUnit.SECONDS));
|
||||
for (ConsumerRecord<String, Object> next : records) {
|
||||
ConsumerSpecificClass<?> callback = callbacks.get(next.topic());
|
||||
Object o = json.readValue((String) next.value(), callback.getClazz());
|
||||
callback.acceptRaw(o);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
} catch (WakeupException e) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue