Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement binary protocol between client and server #297

Open
wants to merge 2 commits into
base: 2.5.x
Choose a base branch
from

Conversation

melix
Copy link
Collaborator

@melix melix commented May 30, 2023

This commit introduces a custom protocol for communicating between the client and the server. Instead of using JSON, it now uses a binary protocol. This removes the requirement of having Micronaut JSON on the user classpath (on the client side) and further reduces the number of dependencies of the server.

This is a major breaking change, and it's no longer possible to directly use tools like cURL or httpie to talk to the server.

This is blocked by micronaut-projects/micronaut-core#9331

This commit introduces a custom protocol for communicating
between the client and the server. Instead of using JSON, it now
uses a binary protocol. This removes the requirement of having
Micronaut JSON on the user classpath (on the client side) and
further reduces the number of dependencies of the server.

This is a major breaking change, and it's no longer possible
to directly use tools like cURL or httpie to talk to the server.

This is blocked by micronaut-projects/micronaut-core#9331
@melix melix added type: improvement A minor improvement to an existing feature status: awaiting third-party Awaiting changes to a third party library type: breaking Introduces a breaking change labels May 30, 2023
@melix melix requested a review from graemerocher May 30, 2023 09:18
@melix melix self-assigned this May 30, 2023
@melix
Copy link
Collaborator Author

melix commented May 30, 2023

Sonar analysis seems completely off.

public void writeTo(Argument<T> type, MediaType mediaType, T object, MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException {
try {
var dos = new DataOutputStream(outputStream);
outgoingHeaders.set("Content-Type", TEST_RESOURCES_BINARY_MEDIA_TYPE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use the HttpHeaders type that has constants for this

outgoingHeaders.set("Content-Type", TEST_RESOURCES_BINARY_MEDIA_TYPE);
TestResourcesCodec.writeObject(object, dos);
} catch (IOException e) {
throw new CodecException("Invalid binary stream", e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps make these error messages more descriptive so we know it is coming from test resources

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting third-party Awaiting changes to a third party library type: breaking Introduces a breaking change type: improvement A minor improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants