diff --git a/horizon-core/src/main/java/de/telekom/eni/pandora/horizon/mongo/repository/MessageStateMongoRepo.java b/horizon-core/src/main/java/de/telekom/eni/pandora/horizon/mongo/repository/MessageStateMongoRepo.java index acd9919..633d3cf 100644 --- a/horizon-core/src/main/java/de/telekom/eni/pandora/horizon/mongo/repository/MessageStateMongoRepo.java +++ b/horizon-core/src/main/java/de/telekom/eni/pandora/horizon/mongo/repository/MessageStateMongoRepo.java @@ -43,10 +43,10 @@ public interface MessageStateMongoRepo extends MongoRepository findByStatusInAndDeliveryTypeAndSubscriptionIdAsc(List status, DeliveryType deliveryType, String subscriptionId, Pageable pageable); - @Query(value = "{'_id': {$gt: ?0}, deliveryType: ?1}", sort = "{timestamp: 1}") - List findByDeliveryTypeAndAfterObjectIdAsc(ObjectId objectId, DeliveryType deliveryType); - @Query(value = "{'_id': {$gt: ?0}, deliveryType: ?1}", sort = "{timestamp: 1}") - Slice findByDeliveryTypeAndAfterObjectIdAsc(ObjectId objectId, DeliveryType deliveryType, Pageable pageable); + @Query(value = "{deliveryType: ?0, subscriptionId: {$in: ?1}, timestamp: { $gt: ?0 }}", sort = "{timestamp: 1}") + List findByDeliveryTypeAndSubscriptionAndTimestampGreaterThanAsc(DeliveryType deliveryType, String subscriptionId, Date timestamp); + @Query(value = "{deliveryType: ?0, subscriptionId: {$in: ?1}, timestamp: { $gt: ?0 }}", sort = "{timestamp: 1}") + Slice findByDeliveryTypeAndSubscriptionAndTimestampGreaterThanAsc(DeliveryType deliveryType, String subscriptionId, Date timestamp, Pageable pageable); @Query(value = "{status: {$in: ?0}, deliveryType: ?1, subscriptionId: {$in: ?2}}", sort = "{timestamp: 1}") List findByStatusInAndDeliveryTypeAndSubscriptionIdsAsc(List status, DeliveryType deliveryType, List subscriptionIds);