microsoft / durabletask-java

Java SDK for Durable Functions and the Durable Task Framework
MIT License
14 stars 7 forks source link

Error querying Instance Table from function #168

Closed kanupriya15025 closed 1 year ago

kanupriya15025 commented 1 year ago

I am trying to read instance table data into one of my monitoring functions. The intent here is to find all the different type of statuses for different orchestrations for reporting purposes. Now I am using java sdk for storage table and on reading the entity, I get the below error :

java.lang.IllegalArgumentException: 'RowKey' must be a non-empty String.

This is the code I am trying to use to read the table :

        try {
            // Create a TableClient with a connection string.
            TableClient tableClient = new TableClientBuilder()
                    .connectionString(connectionString)
                    .tableName("JavaTestHubInstances")
                    .buildClient();

           // ListEntitiesOptions options = new ListEntitiesOptions().setFilter("RuntimeStatus" + " eq 'Running'");

            // Loop through the results, displaying information about the entities.
            tableClient.listEntities(null, null, null).forEach(tableEntity -> {
                System.out.println(tableEntity.toString());
            });
        } catch (Exception e) {
            // Output the stack trace.
            e.printStackTrace();
        }

I know in instance table the row keys are empty, so how do you suggest I read the table?

cgillum commented 1 year ago

java.lang.IllegalArgumentException: 'RowKey' must be a non-empty String.

This seems like an issue with the Azure Table Storage SDK for Java.

We use the empty string "" for the row key in the Instances table, so if the Java SDK doesn't support querying rows with empty row keys (which I would consider a bug), you might need to look into using another library, or accessing the storage over HTTP.

kanupriya15025 commented 1 year ago

I was able to query it using REST API. Thanks!