dakotahNorth / solace-spring-boot-starter

0 stars 0 forks source link

Sweep: Remove messageType and eventClass from MessageHandler #5

Closed sweep-ai[bot] closed 6 months ago

sweep-ai[bot] commented 6 months ago

PR Feedback: πŸ‘

Description

This pull request introduces changes to the MessageHandler annotation and the SolaceMessageListener class to simplify the message handling process by making the messageType and eventClass attributes optional. It also updates a test case to reflect these changes.

Summary

Fixes #4.


πŸŽ‰ 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 get Sweep to edit this pull request, you can:

This is an automated message generated by Sweep AI.

sweep-ai[bot] commented 6 months ago

Rollback Files For Sweep

This is an automated message generated by Sweep AI.

dakotahNorth commented 6 months ago

That is great.

No please remove classType since that can always be extracted from the passed in messageHandler.

Add a test where the message Type that is specified on the JSON is different from the messageType, and therefore MessageType is needed to translate that JSON message to a speific type.

For example, a test like the below

final void testReceivingDifferntJSONExampleEvent() {

      // Arrange
      String jsonMessage = "{\"messageType\":\"DefaultEvent\",\"data\":\"Hello, Default!\"}";

      // Act
      solaceMessageListener.onMessageReceived(jsonMessage);

      // Assert
      assertEquals(1, testMessageHandler.receivedEvents.size(), "Incorrect Number of Events");
      ExampleEvent receivedEvent = testMessageHandler.receivedEvents.getFirst();
      assertEquals("Hello, Default!", receivedEvent.getData(), "Data Mismatch");

  }

and the messageHandler is defeind similar to below:

   @MessageHandler(messageType = "DefaultEvent")
    public final void handleExampleEvent(ExampleEvent event) {
        receivedEvents.add(event);
    }

Both test then need to pass.

sweep-ai[bot] commented 6 months ago

πŸš€ Wrote Changes

Done.

This is an automated message generated by Sweep AI.