thoughtworks / pacto

Pacto settles disputes between JSON providers and consumers
thoughtworks.github.io/pacto
MIT License
401 stars 58 forks source link

Cleanup: Use LiveActor to cleanup Pacto Server code #143

Open maxlinc opened 10 years ago

maxlinc commented 10 years ago

Originally proposed in #115 and #114.

LiveProviderActor - Proxies the request to a real service endpoint, either the actual provider or an out of process stub server like Mountebank or Mimic.

This could help clean up the Pacto Server code, especially, but could also be useful for normal Pacto.

Something like this might be especially useful:

Pacto::Generator 'Cloud Servers' do
  actor LiveActor, backend: 'http://localhost:3000'
  load_contracts 'contracts/cloud_servers'
end

Pacto::Generator 'Cloud Files' do
  actor LiveActor, backend: 'http://localhost:4000'
  load_contracts 'contracts/cloud_files'
end

Note that this allows Pacto to proxy different services to different endpoints (port 3000 vs 4000 above). This would it easier to use Mimic or Mountebank, which both open differnet ports.