Virtual Services (using multiple ports)

« Back to documentation home

Virtual Services (using multiple ports)

Traffic Parrot supports multiple virtual services in one Traffic Parrot instance. For example, when implementing HTTP virtual services you can run each of them on separate ports.

Supported protocols

Currently the following protocols fully support the virtual services feature:
  • HTTP
  • HTTPS
  • Native IBM® MQ
  • JMS
Limited support is provided for the following protocols, as per the existing scenarios feature documentation:
  • gRPC
  • Files

Architecture

  • Each Traffic Parrot server can host one or more virtual services
  • Each virtual service has a separate configuration directory on the filesystem, including:
  • HTTP virtual services can be run on multiple ports
  • MQ virtual services can connect to multiple queue managers
  • JMS virtual services can connect to multiple brokers
Traffic Parrot Virtual Services Directories Architecture Diagram
Traffic Parrot Virtual Services Multiple HTTP Ports Architecture Diagram
Traffic Parrot Virtual Services Multiple Queue Managers Ports Architecture Diagram
Traffic Parrot Virtual Services Home

Managing Virtual Services

The virtual services can be managed using the Virtual Services UI page:

Traffic Parrot Virtual Services List
Add Virtual Service
To add a virtual service, click the new virtual service button:
Traffic Parrot New Virtual Service Button
Which will show a create dialog:
Traffic Parrot New Virtual Service Dialog

Click the submit button to create the virtual service. If a valid free HTTP/HTTPS port is specified, then the virtual service will be accessible on the ports specified.

Edit Virtual Service
To edit a virtual service, click the edit virtual service button for an existing virtual service in the list:
Traffic Parrot Edit Virtual Service Button
Traffic Parrot Edit Virtual Service Dialog

Click the submit button to edit the virtual service. If a valid free HTTP/HTTPS port is specified, then the virtual service will be accessible on those ports. The service will no longer be accessible on the old ports.

Delete Virtual Service
To delete a virtual service, click the delete virtual service button for an existing virtual service in the list:
Traffic Parrot Delete Virtual Service Button
Traffic Parrot Delete Virtual Service Dialog

Click the delete button to delete the virtual service. The service will no longer be accessible on the old port. The deleted virtual service mappings will be backed up in the deleted-scenarios directory.

Select Virtual Service
To select a virtual service, click on the name of the virtual service in the dropdown at the top of the page. This can be accessed from any page.
Traffic Parrot Select Virtual Service

Once selected, the following will happen:

  • The default HTTP virtual service port of 8080 will serve the selected virtual service over HTTP
  • The default HTTPS virtual service port of 8081 will serve the selected virtual service over HTTPS
  • The custom HTTP/HTTPS ports assigned to each virtual service remain active regardless of the currently selected virtual service
  • The Add/Edit/Record/Replay pages for all protocols now impact the currently selected virtual service
Virtual Service Properties
Each virtual service has a service.properties file that is used to specify configuration such as custom HTTPS certificates and MQ startup settings:
Property name Description Example usage
http.port The HTTP port for the virtual service http.port=9017
https.port The HTTPS port for the virtual service https.port=9018
https.key.store.path Path to the HTTPS key store to use, relative to the virtual service directory https.key.store.path=certs/server.jks
https.key.store.password The password for the HTTPS key store https.key.store.password=password
https.key.manager.password The password for the HTTPS key store manager https.key.manager.password=password
https.key.store.type The type of key store used, for example JKS or PKCS12 https.key.store.type=JKS
https.need.client.auth Whether client authentication is required. Set to true or false. https.need.client.auth=true
https.trust.store.path Path to the HTTPS trust store to use, relative to the virtual service directory https.trust.store.path=certs/servertrust.jks
https.trust.store.password The password for the HTTPS trust store https.trust.store.password=password
https.trust.store.type The type of trust store used, for example JKS or PKCS12 https.trust.store.type=JKS
ibm.mq.queue.replay.on.startup When set to true, replay mode will be enabled for this virtual service ibm-mq-mappings on startup ibm.mq.queue.replay.on.startup=true
ibm.mq.queue.replay.request.queue.manager The name of the queue manager to connect to consume request messages, as specified in ibm-mq-connections.json ibm.mq.queue.replay.request.queue.manager=REQ.QM
ibm.mq.queue.replay.response.queue.manager The name of the queue manager to connect to produce response messages, as specified in ibm-mq-connections.json ibm.mq.queue.replay.response.queue.manager=RSP.QM
jms.queue.replay.on.startup When set to true, replay mode will be enabled for this virtual service jms-mappings on startup jms.queue.replay.on.startup=true
jms.queue.replay.request.connection.id The id of the connection to use to consume request messages, as specified in jms-connections.json jms.queue.replay.request.connection.id=1
jms.queue.replay.response.connection.id The id of the connection to use to produce response messages, as specified in jms-connections.json jms.queue.replay.response.connection.id=2

Virtual Service Configuration

HTTP

To configure a HTTP virtual service you should:

  1. (optional) Follow the instructions to add a new virtual service and specify a HTTP port
  2. Follow the instructions to select a virtual service
  3. Use the HTTP UI to Add/Edit mappings

HTTPS

To configure a HTTPS virtual service you should:

  1. Follow the instructions to configure a HTTP virtual service and specify a HTTPS port
  2. (optional) Configure HTTPS configuration in the scenarios/ServiceName/service.properties file:
    • https.key.store.path=certs/server.jks
    • https.key.store.password=password
    • https.key.manager.password=password
    • https.key.store.type=JKS
    • https.need.client.auth=true
    • https.trust.store.path=certs/servertrust.jks
    • https.trust.store.password=password
    • https.trust.store.type=JKS

Native IBM® MQ

To configure a Native IBM® MQ virtual service you should:

  1. Configure the required IBM® MQ JARs (only needs to be done once per Traffic Parrot instance)
  2. (optional) Follow the instructions to add a new virtual service
  3. Follow the instructions to select a virtual service
  4. Configure the scenarios/ServiceName/ibm-mq-connections.json file
  5. Use the Native IBM® MQ UI to Add/Edit mappings and turn on replay mode
  6. (optional) Configure Native IBM® MQ startup configuration in the scenarios/ServiceName/service.properties file:
    • ibm.mq.queue.replay.on.startup=true
    • ibm.mq.queue.replay.request.queue.manager=REQ.QM
    • ibm.mq.queue.replay.response.queue.manager=RSP.QM

JMS

To configure a JMS virtual service you should:

  1. (optional) Configure the required IBM® MQ JARs (only needs to be done once per Traffic Parrot instance and if using IBM® MQ as your JMS connection type)
  2. (optional) Follow the instructions to add a new virtual service
  3. Follow the instructions to select a virtual service
  4. Configure the scenarios/ServiceName/ibm-mq-connections.json file
  5. Use the JMS UI to Add/Edit mappings and turn on replay mode
  6. (optional) Configure JMS startup configuration in the scenarios/ServiceName/service.properties file:
    • jms.queue.replay.on.startup=true
    • jms.queue.replay.request.connection.id=1
    • jms.queue.replay.response.connection.id=2

Limitations

  • The UI can only be used to make changes to one virtual service at a time
  • The UI does not support editing the following configuration, which must be configured directly using the file system and a text editor:
    • scenarios/ServiceName/service.properties
    • scenarios/ServiceName/data
    • scenarios/ServiceName/ibm-mq-connections.json
    • scenarios/ServiceName/jms-connections.json
    • scenarios/ServiceName/database-connections.json
  • Live changes to virtual services names and ports are only picked up if the changes are made via the UI (changes directly to the filesystem of a running instance are not picked up dynamically)
  • Only one Files/gRPC virtual service can be set to record or replay mode at a time
  • Switching virtual service while replay mode is active for Files is not supported and replay must be stopped before switching

Old version warning!

This documentation is for an old version of Traffic Parrot. There is a more recent Traffic Parrot version available for download at trafficparrot.com

Browse documentation for recent version