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

Add blocking unary generation #50

Merged
merged 16 commits into from
Aug 11, 2023

Conversation

buildbreaker
Copy link
Contributor

@buildbreaker buildbreaker commented Jun 2, 2023

Providing options for generating synchronous methods for unary RPC calls:

        val response = testServiceConnectClient.unaryCallBlocking(message)
        assertThat(response.code).isEqualTo(Code.UNKNOWN)
        response.failure { errorResponse ->
            assertThat(errorResponse.error).isNotNull()
            assertThat(errorResponse.code).isEqualTo(Code.UNKNOWN)
            assertThat(errorResponse.error.message).isEqualTo("test status message")
        }
        response.success {
            fail<Unit>("unexpected success")
        }

Copy link
Contributor

@rebello95 rebello95 left a comment

Choose a reason for hiding this comment

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

Let's make sure to add docs on this to the Connect site as well

@buildbreaker
Copy link
Contributor Author

@rebello95 Do you prefer "synchronous" or "blocking"?

@rebello95
Copy link
Contributor

rebello95 commented Jun 14, 2023

@rebello95 Do you prefer "synchronous" or "blocking"?

Don't have a strong preference, but leaning towards blocking. I would just avoid sync by itself

/**
* Execute the underlying request.
*/
fun execute(): ResponseMessage<Output> {
Copy link
Contributor

Choose a reason for hiding this comment

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

What prevents this from being called multiple times?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't prevented. OkHttp also does this!

@buildbreaker buildbreaker force-pushed the achiu/add-synchronous-unary-generation branch from 9abe7e6 to e5deb8b Compare August 10, 2023 20:55
@buildbreaker buildbreaker changed the title Add synchronous unary generation Add blocking unary generation Aug 10, 2023
@buildbreaker buildbreaker merged commit 2e45257 into main Aug 11, 2023
7 checks passed
@buildbreaker buildbreaker deleted the achiu/add-synchronous-unary-generation branch August 11, 2023 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants