Giriş
Şu satırı dahil ederiz
import com.hazelcast.collection.QueueStore;
Bu sınıfı QueueStoreWrapper çağırır
Örnek - SpringBoot Kullanan
Şöyle yaparız
@Component public class PostgresQueueStore implements QueueStore<Event> { EventRepository eventRepository; public PostgresQueueStore(@Lazy EventRepository eventRepository) { this.eventRepository = eventRepository; } @Override public void store(Long key, Event value) { EventEntity entity = ...; eventRepository.save(entity); } @Override public void storeAll(Map<Long, Event> map) { Collection<EventEntity> eventEntities = map.entrySet().stream() .map(entry -> ...) .toList(); eventRepository.saveAll(eventEntities); } @Override public void delete(Long key) { eventRepository.deleteById(key); } @Override public void deleteAll(Collection<Long> keys) { eventRepository.deleteAllById(keys); } @Override public Event load(Long key) { return eventRepository.findById(key) .map(e -> ...) .orElse(null); } @Override public Map<Long, Event> loadAll(Collection<Long> keys) { List<EventEntity> entities = eventRepository.findAllById(keys); return entities.stream().collect(Collectors.toMap(EventEntity::getId, e -> ...); } @Override public Set<Long> loadAllKeys() { List<EventEntity> events = eventRepository.findAll(); return events.stream().map(EventEntity::getId).collect(Collectors.toSet()); } }