Question about message pacts - at the moment PactN...
# libpact_ffi-users
a
Question about message pacts - at the moment PactNet writes the pact file (in merge mode) after verifying each interaction, but that seems wasteful. I can't remember why it's done that way though - is it necessary/recommended via the FFI or should the pact file just be written once? I know for request pacts it's necessary because the mock server can only be configured once per verification, but I can't think of a reason why message pacts have that restriction
m
I can’t remember myself
a
Yeah I feel like I can make one message pact handle, but lots of message handles, and then just write the pact file once at the end. I suppose it's a bit theoretical though. Even if you write the file 100 times in merge mode it's not exactly gonna destroy performance, it just irks that it's inefficient 😂
m
haha yes. It’s plausible to do it that way, I’d need to look at the interface again
Maybe we did it because it was easier to port existing implementations over?
u
With Pact-JVM, some people create a separate test for each interaction. I've seen one with 12 interactions, each a separate test. In that case, it has to merge otherwise they will overwrite each other
👍 1
a
Yeah, we do a separate test for each interaction also. The question was more about whether you need to write the pact after each interaction or not, i.e. do I need to do this: • Create pact handle • Create message handle • Verify • Write pact file • GOTO 1 or this: • Create pact handle • Create message handle • Verify • Create message handle • Verify • Create message handle • Verify • Write pact file