From HTTP Multithreading
The From HTTP Multithread component is designed to work with the From HTTP Multithread Worker to enable parallel processing of requests. These components have two distinct roles:
-
From HTTP Multithread is the dispatcher component which listens for requests and sends it to the worker component for parallel processing using
iguana.callComponentFunction(previouslycomponent.callprior to v10.1.111). -
From HTTP Multithread Worker component handles the actual processing of the data dispatched by the From HTTP Multithread component.
The From HTTP Multithread and From HTTP Multithread Worker components require IguanaX v10.1.111 or later.
Running the Components:
STEP 1: Import the From HTTP Multithread and From HTTP Multithread Worker components
Using +COMPONENT, import two components:
-
From HTTP Multithread
-
From HTTP Multithread Worker
These are standalone components and must not be directly connected.
![]()
STEP 2: Configure the custom fields
The two components are pre-configured to work together by default. However, the custom fields can be modified as needed:
From HTTP Multithread:
-
WorkerComponent: The target multithreaded worker component -
Port: The web service port. Change if the default port, 7778, is already in use. -
UseHTTPS: Default is set to true to enable HTTPS. For production, you should configure Iguana to use your ownCertificateandPrivateKeyfiles.
![]()
From HTTP Multithread Worker:
-
ServerComponent: The name of the web service component which will dispatch requests to the worker. -
ThreadCount: Number of processing threads. Can be set as a number from 2 to 100.
![]()
STEP 3: Setup two test source data feed to send requests to the From HTTP Multithread component
You can use any mechanism to send HTTP requests to the From HTTP Multithread component configured endpoint - default is https://localhost:7778/. If your Iguana instance is running remotely you can use the public IP address.
If you want to use Iguana as the test source system to create a data feed, you can use the following simple setup:
-
Create two custom components named “Source Feed 1“ and “Source Feed 2“
-
Copy the script below into each of component's Translator to send an HTTP GET Request to the From HTTP Multithread component.
function main(Data)
component.setTimer{delay=1000}
net.http.get{url="https://127.0.0.1:7778"}
end
-
Start the feed components and watch the requests in the logs of the web service components.
Adapting the Components:
Add data processing logic in the worker
Inbound requests are sent to the Worker from the From HTTP Multithread component as JSON strings. Requests are parsed and at this point, any data processing can be implemented. See the following screenshot as an example (specifically steps 2.1 and 3):
![]()
Customize the worker response
A general response is constructed in the worker and sent back to the From HTTP Multithread component. If adapted, the response must contain three pieces of information:
-
You must first use the
SetHeadersfunctionto set the required response headers as they contain connection information for which request to respond to. -
You can include any additional headers required by customizing that function or adding your own.
-
You can customize the response body(see the previous expandable for an example).
Once constructed, iguana.callComponentFunction (previously component.call) is used to call the WEBrespond function in the From HTTP Multithread component with the response data so it can respond to the source connection.
Add downstream components to the worker
Simply connect a component from the dashboard, uncomment the queue.push statement at the bottom of the translator, select the data you would like to push then start the components and watch the data flow through.
Additional Information:
The From HTTP Multithread component serves as a listener to incoming HTTP/HTTPs requests and will be the component responding back. The worker component is only responsible for processing as well as creating a response for the listener to use.
To that extent, code changes to the From HTTP Multithread component are not required in most cases as the Worker component will perform all of the processing. By default the Worker will create a simple “Hello World” response for the listener to respond with.