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

FFI calls > Support generators for async message #338

Closed
tienvx opened this issue Nov 17, 2023 · 10 comments
Closed

FFI calls > Support generators for async message #338

tienvx opened this issue Nov 17, 2023 · 10 comments

Comments

@tienvx
Copy link
Contributor

tienvx commented Nov 17, 2023

These scenarios in compatibility suite indicate that generators are supported for async message on consumer side:

But currently I think generators are not working when using this pactffi_message_reify FFI call.

@mefellows
Copy link
Member

Reify doesn't support synchronous messages and a bunch of things. I think you're best using the message-related iterators to extract these values. The method should probably be marked as deprecated.

@tienvx
Copy link
Contributor Author

tienvx commented Nov 17, 2023

I don't know how to use those iterators methods yet. I can't find any example code. Look like there are no language using those methods yet?

btw thanks for the suggestion.

@mefellows
Copy link
Member

@tienvx
Copy link
Contributor Author

tienvx commented Nov 17, 2023

Using these methods:

  • pactffi_pact_handle_get_message_iter
  • pactffi_pact_message_iter_next
  • pactffi_message_get_contents

I'm able to get the message content, but it's exactly the same with the result from pactffi_message_reify, which doesn't have any values generated by generators.

Plus I have a panic Caught panic with error: iter past the end of metadata while using these methods (there is no way I can handle it from php side):

  • pactffi_message_get_metadata_iter
  • pactffi_message_metadata_iter_next

@tienvx tienvx changed the title Support generators for pactffi_message_reify FFI calls > Support generators for async message Nov 17, 2023
@tienvx
Copy link
Contributor Author

tienvx commented Nov 21, 2023

I'm able to use those iterator methods, but there 2 small problems:

I also updated pactffi_message_reify with this PR #342, so for now I will continue using it.

@tienvx
Copy link
Contributor Author

tienvx commented Nov 21, 2023

Closed as implemented

@tienvx tienvx closed this as completed Nov 21, 2023
@mefellows
Copy link
Member

Nice one! I'm interested - does this work on synchronous messages also (both the request and/or response side)?

@tienvx
Copy link
Contributor Author

tienvx commented Nov 21, 2023

I didn't touch on synchronous message FFI calls. But I have a quick look at synchronous_messages_iter and I think it is already implemented:

Currently I can't implement synchronous message in compatibility suite in PHP so I can't test it.

@mefellows
Copy link
Member

oh yes, I know they support generators. I guess I was asking if you could use pactffi_message_reify on a sync message. I can look at code, I was being lazy :P

@tienvx
Copy link
Contributor Author

tienvx commented Nov 21, 2023

if you could use pactffi_message_reify on a sync message

No, I don't think so.

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

No branches or pull requests

2 participants