Manojred1236 opened a new issue, #11310:
URL: https://github.com/apache/ignite/issues/11310
When data available in cache fetching the data from cache using Index query
throwing below error
**org.apache.ignite.client.ClientException: Ignite failed to process request
[19]: com.cisco.cjp.cache.model.EntityValue (server status code [1])**
**Ignite Configuration**
@Bean
Map<ResourceType, ClientCache<String, EntityValue>>
**entityCaches**(IgniteClient client, MeterRegistry meterRegistry) {
Map<ResourceType, ClientCache<String, EntityValue>> result = new
EnumMap<>(ResourceType.class);
Arrays.stream(ResourceType.values()).forEach(r -> {
ClientCacheConfiguration cacheCfg = new
ClientCacheConfiguration()
.setName(r.resourceName)
.setCacheMode(CacheMode.PARTITIONED)
.setStatisticsEnabled(true)
.setBackups(numberOfBackupNodes)
.setPartitionLossPolicy(PartitionLossPolicy.IGNORE)
.setQueryEntities(createEntityValueQueryEntity());
ClientCache<String, EntityValue> cache =
client.getOrCreateCache(cacheCfg);
result.put(r, cache);
Gauge.builder(
"cache_" + cache.getName() + "_size",
cache,
ClientCache::size
)
.register(meterRegistry);
});
return result;
}
private static QueryEntity **createEntityValueQueryEntity**() {
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("dtoJson", String.class.getName());
LinkedHashMap<String, String> alias = new LinkedHashMap<>();
fields.put("dtoJson", "dto_json");
return new QueryEntity(String.class,EntityValue.class)
.setAliases(alias)
.setValueFieldName("dtoJson")
.setFields(fields)
.addQueryField("dbId", String.class.getName(),
null)
.setIndexes(Arrays.asList(new
QueryIndex("dbId").setName("DB_ID_IDX")));
}
**Entity Value**
@Data
@RequiredArgsConstructor
public class EntityValue implements Serializable {
private static final long serialVersionUID = 2826796212018108592L;
private final String entityId;
@GridToStringInclude
private final String dtoJson;
private final String type;
private final String organizationId;
@GridToStringInclude
@QuerySqlField(orderedGroups = { @QuerySqlField.Group(name =
"DB_ID_IDX", order = 0), })
private final String dbId;
private final String ciUserId;
private final String subType;
}
**Index Query**
IndexQuery<String, EntityValue> idxQry = new IndexQuery<String,
EntityValue>(EntityValue.class);
List<Cache.Entry<String, EntityValue>> result =
entityCache.query(idxQry).getAll();
System.out.println("Result size is ::"+result.size());
for (Entry<String, EntityValue> c : result) {
String dtoJson = c.getValue().getDtoJson();
System.out.println("Response is ::"+dtoJson);
}
Not finding a appropriate logs/reason why the index query not working with
Thin client
Please assist if there are any configuration changes required.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]