Re: Paging in Cassandra

2018-08-08 Thread Ghazi Naceur
Hello everyone,

This is the solution :

@Autowired
CassandraOperations cassandraOperationsInstance;

...
...
Pageable request = CassandraPageRequest.first(1000);
Slice slice = null;
Query query = Query.empty().pageRequest(request);

do {
slice = cassandraOperationsInstance.slice(query, clazz);
if (slice.hasContent()) {
slice.getContent().forEach(s -> {
// treatement ...
});
}
if (slice.hasNext()) {
request = slice.getPageable();
query = query.pageRequest(request);
} else {
break;
}
} while (!slice.getContent().isEmpty());

Best regards.

2018-07-10 14:44 GMT+01:00 Alain RODRIGUEZ :

> Hello,
>
> It sounds like a client/coding issue. People are working with distinct
> clients to connect to Cassandra. And it looks like there are not many
> 'spring-data-cassandra' users around ¯\_(ツ)_/¯.
>
> You could try giving a try there see if you have more luck:
> https://spring.io/questions.
>
> C*heers,
>
> Alain
>
> 2018-07-05 6:21 GMT+01:00 Ghazi Naceur :
>
>> Hello Eveyone,
>>
>> I'm facing a problem with CassandraPageRequest and Slice.
>> In fact, I'm always obtaining the same Slice and I'm not able to get the
>> next slice (or Page) of data.
>> I'm based on this example :
>>
>> Link : https://github.com/spring-projects/spring-data-cassandra/pull/114
>>
>>
>> Query query = 
>> Query.empty().pageRequest(CassandraPageRequest.first(10));Slice slice 
>> = template.slice(query, User.class);
>> do {
>> // consume slice
>> if (slice.hasNext()) {
>> slice = template.select(query, slice.nextPageable(), User.class);
>> } else {break;
>> }
>> } while (!slice.getContent().isEmpty());
>>
>>
>>
>> I appreciate your help.
>>
>
>


Re: Paging in Cassandra

2018-07-10 Thread Alain RODRIGUEZ
Hello,

It sounds like a client/coding issue. People are working with distinct
clients to connect to Cassandra. And it looks like there are not many
'spring-data-cassandra' users around ¯\_(ツ)_/¯.

You could try giving a try there see if you have more luck:
https://spring.io/questions.

C*heers,

Alain

2018-07-05 6:21 GMT+01:00 Ghazi Naceur :

> Hello Eveyone,
>
> I'm facing a problem with CassandraPageRequest and Slice.
> In fact, I'm always obtaining the same Slice and I'm not able to get the
> next slice (or Page) of data.
> I'm based on this example :
>
> Link : https://github.com/spring-projects/spring-data-cassandra/pull/114
>
>
> Query query = 
> Query.empty().pageRequest(CassandraPageRequest.first(10));Slice slice = 
> template.slice(query, User.class);
> do {
> // consume slice
> if (slice.hasNext()) {
> slice = template.select(query, slice.nextPageable(), User.class);
> } else {break;
> }
> } while (!slice.getContent().isEmpty());
>
>
>
> I appreciate your help.
>


Paging in Cassandra

2018-07-04 Thread Ghazi Naceur
Hello Eveyone,

I'm facing a problem with CassandraPageRequest and Slice.
In fact, I'm always obtaining the same Slice and I'm not able to get the
next slice (or Page) of data.
I'm based on this example :

Link : https://github.com/spring-projects/spring-data-cassandra/pull/114


Query query = 
Query.empty().pageRequest(CassandraPageRequest.first(10));Slice
slice = template.slice(query, User.class);
do {
// consume slice
if (slice.hasNext()) {
slice = template.select(query, slice.nextPageable(), User.class);
} else {break;
}
} while (!slice.getContent().isEmpty());



I appreciate your help.