dakotahNorth / HelloWorldSpringCloudStream

0 stars 0 forks source link

Do not endlessly retry message conversion when converting a message throws an exception #4

Open dakotahNorth opened 5 months ago

dakotahNorth commented 5 months ago

Stop Spring Cloud Stream from continuing to retry converting messages when a message can't be converted.

Instead, log that the message can't be converted and then process the next message.

The exception that is thrown is below ...

2024-04-28T15:46:03.710-04:00  WARN 36594 --- [HelloWorldSpringCloudStream] [pool-3-thread-1] s.c.f.c.c.SmartCompositeMessageConverter : Failure during type conversion by com.example.helloworld.ManifoldJsonMessageConverter@537cc059. Will try the next converter.

java.lang.RuntimeException: manifold.rt.api.ScriptException: Found errors:
[1:2] expecting '}', found 'foo'

    at manifold.json.rt.Json.fromJson(Json.java:302) ~[manifold-json-rt-2024.1.12.jar:2024.1.12]
    at manifold.json.rt.Json.fromJson(Json.java:292) ~[manifold-json-rt-2024.1.12.jar:2024.1.12]
    at com.example.helloworld.ManifoldJsonMessageConverter.convertFromInternal(ManifoldJsonMessageConverter.java:33) ~[main/:na]
Checklist - [X] Modify `src/main/java/com/example/helloworld/ManifoldJsonMessageConverter.java` βœ“ https://github.com/dakotahNorth/HelloWorldSpringCloudStream/commit/61974a5de79d9bdb717c62fabe1a3d6d7142eae7 [Edit](https://github.com/dakotahNorth/HelloWorldSpringCloudStream/edit/sweep/do_not_endlessly_retry_message_conversio/src/main/java/com/example/helloworld/ManifoldJsonMessageConverter.java)
sweep-ai[bot] commented 5 months ago

πŸš€ Here's the PR! #5

See Sweep's progress at the progress dashboard!
πŸ’Ž Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: 9db6cbfa53)
Install Sweep Configs: Pull Request

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)


Step 1: πŸ”Ž Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/dakotahNorth/HelloWorldSpringCloudStream/blob/a76ab493f7569e2256f97c224e68a8a9efe18f8e/src/main/java/com/example/helloworld/ManifoldJsonMessageConverter.java#L1-L45

Step 2: ⌨️ Coding

catch (manifold.rt.api.ScriptException e) {
    // Log an error message with the details of the exception 
    log.error("Error converting JSON to object: {}", e.getMessage(), e);
    // Return null to allow other converters to be tried or skip the message
    return null;
}

This will catch the specific ScriptException, log an error message with the exception details, and return null. Returning null allows Spring Cloud Stream to either try other message converters or skip the message and move on to the next one, rather than retrying this converter endlessly.


Step 3: πŸ” Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/do_not_endlessly_retry_message_conversio.


πŸŽ‰ Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

πŸ’‘ To recreate the pull request edit the issue title or description. Something wrong? Let us know.

This is an automated message generated by Sweep AI.