You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/06/23 08:55:04 UTC

[GitHub] [pulsar] pfalez opened a new issue, #16193: Function State differs between Java SDK and Rest API

pfalez opened a new issue, #16193:
URL: https://github.com/apache/pulsar/issues/16193

   **Describe the bug**
   When storing a buffer larger than 130 bytes with Java Functions SDK, retrieving this buffer with the Rest API give a larger buffer.
   
   Example with a buffer of size 131
   
   Stored buffer: (size: 131)
   `0a8001127e0a172e6576656e74732e437573746f6d65724372656174656412630a2432336366666263652d623038342d346631352d616565342d32633064313535613166636312026e311a3700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`
   
   Retrieved buffer: (size: 133)
   `0aefbfbd01127e0a172e6576656e74732e437573746f6d65724372656174656412630a2435386565316337302d383937612d346638642d623837662d33366463656431626437373512026e311a3700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`
   
   the `0a8` seems common to all message that exceeds 130 bytes
   
   **To Reproduce**
   Code in pulsar function:
   ```java
   context.putState(input.getAggregateId(), ByteBuffer.wrap(message.toByteArray()));
   ```
   
   Code in client:
   ```typescript
   const response = await http.default.get(
     '${this.apiConfig.host}/admin/v3/functions/${params.tenant}/${params.namespace}/${params.name}/state/${params.key}',
   );
   return Buffer.from(response.data.stringValue, 'utf-8');
   ```
   
   **Expected behavior**
   The two buffer should always equals
   
   
   **Desktop (please complete the following information):**
    - OS: Linux
    - Pulsar 2.9.1
   
   **Additional context**
   Tested on Standalone and cluster version
   


-- 
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: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] coderzc commented on issue #16193: Function State differs between Java SDK and Rest API

Posted by GitBox <gi...@apache.org>.
coderzc commented on issue #16193:
URL: https://github.com/apache/pulsar/issues/16193#issuecomment-1164383605

   It seems should use `response.data.byteValue` to receive the buffer.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] pfalez commented on issue #16193: Function State differs between Java SDK and Rest API

Posted by GitBox <gi...@apache.org>.
pfalez commented on issue #16193:
URL: https://github.com/apache/pulsar/issues/16193#issuecomment-1164386533

   Yes but this field is always undefined, I don't known how to force pulsar to answer byte instead of string


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] codelipenghui closed issue #16193: Function State differs between Java SDK and Rest API

Posted by GitBox <gi...@apache.org>.
codelipenghui closed issue #16193: Function State differs between Java SDK and Rest API
URL: https://github.com/apache/pulsar/issues/16193


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] coderzc commented on issue #16193: Function State differs between Java SDK and Rest API

Posted by GitBox <gi...@apache.org>.
coderzc commented on issue #16193:
URL: https://github.com/apache/pulsar/issues/16193#issuecomment-1164433339

   > Yes but this field is always undefined, I don't known how to force pulsar to answer byte instead of string
   
   Because it priority to returns a string value first, it does not return a byte value until the string decode failed.
   
   But string decode seems to have a bug, I will try to fix it.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org