- Index

< Previous |  | Next >

# Hotspot FX Trading System Adapter

## Introduction

The TIBCO StreamBase® Adapter for Hotspot FX allows a StreamBase application to retrieve market data from, and submit market requests to, a Hotspot FX trading system. The adapter appears as one, two, or three icons on the EventFlow canvas in StreamBase Studio. All three icons share a single connection to the Hotspot FX server. The three EventFlow canvas icons for this adapter are:

- Input — Retrieves market data, including tickers, quotes, and trades.

- Output — Submits order, bid, offer, buy, sell, and cancel requests to the Hotspot FX trading system.

- Control — Subscribes to and unsubscribes from currency pairs, retrieves trade information and order history, and controls and monitors connection and heartbeat activity.

Each Hotspot FX adapter icon has its own set of input and output ports, the fields for which are defined later in this document. In addition, each icon has its own adapter properties. However, the properties for all Hotspot FX adapter icons must be configured identically. Otherwise, the StreamBase application fails during startup with a message directing you to the misconfiguration.

The Hotspot FX input adapter icon has no input ports and has a set of several output ports on which a tuple is emitted each time a ticker, market, price, trade, or order message is received.

The Hotspot FX output adapter icon has one input port for submitting market requests (bid, offer, buy, sell, and so on) and one output port on which a tuple is emitted with these requests.

The Hotspot FX control adapter icon has one input port for submitting control requests and has a set of output ports on which control request-specific tuples are emitted.

All three adapter icons also have an event output port on which tuples are emitted in response to important adapter events such as connection transitions, adapter suspend and resume activity, and rejected market and control requests.

## Adapter Properties

All three adapter icons have the same properties in the Adapter Settings tab of the Properties view. These settings are typically set in the Parameters bottom tab of the EventFlow editor, and then referenced as adapter parameters in the Properties view.

Property | Description
--- | ---
Hotspot FX Server | The name or IP address of the Hotspot FX server.
Hotspot FX Port | The TCP port number of the Hotspot FX server.
User Name | The user name of your Hotspot FX account.
Password | The password of your Hotspot FX account.
Reconnect Interval | The time, in seconds, to wait between attempts to connect to the Hotspot FX server. This is used both when the StreamBase application starts and later, when the connection to the server is lost.
Connect On Startup | Set to `true` to connect to the Hotspot FX server on start-up and `false` otherwise. The state of the Hotspot FX server connection can be changed after start-up by enqueuing a tuple with an action of `connect` or `disconnect` to the Control adapter's input port.
Receive BBO Only | Set to `true` to subscribe on start-up to only the best bid and offer information from the market and `false` otherwise The BBO subscribe state can be changed after start-up by enqueuing a tuple with an action of `setReceivingBestBidAndOfferOnly` to the Control adapter's input port.
Log Level | Controls the level of verbosity the adapter uses to send notifications to the console. This setting can be higher than the containing application's log level. If set lower, the system log level is used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE.

## Using the Adapter in a StreamBase Application

This section demonstrates how to use the Hotspot FX adapter within a StreamBase application and describes the use of the adapter's ports. As shown in the EventFlow diagram below (taken from this adapter's sample application), the adapter appears as three icons on the canvas: for input, output, and control. Each icon has a specific set of input and output ports to communicate with the surrounding application. As with other StreamBase adapters and operators, you can optionally enable an Error Output Port, as described in Using Error Ports and Error Streams.

### Note

In this adapter's sample application, the adapter's input and output ports are connected directly to externally-visible input and output streams. However, in more complex applications these ports will typically be connected to internal StreamBase operators.

### Description of This Adapter's Ports

#### Hotspot FX Input Adapter Ports

The Hotspot FX input adapter retrieves market data from the trading system. It has no input ports and nine output ports:

- Ticker (output): The input adapter emits tuples on this port when it receives ticker messages. The schema of emitted tuples is:

  - currpair, string: the currency pair. For example, EUR/USD.

  - rate, double: the rate of this ticker.

  - transtime, timestamp: the transaction time of this ticker.

  - action, int: 1 or 2 indicating whether the deal currency was bought or sold, respectively.

  - dollarAction, int: 0, 1, or 2 indicating whether the dollar was not involved, bought, or sold, respectively.

- BBOs (output): The input adapter emits tuples on this port when it receives market messages containing at least one bid and one offer. The top bid and offer in the book are combined in a single BBO tuple. The schema of emitted tuples is:

  - currpair, string: the currency pair. For example, EUR/USD.

  - bidPrice, double: the bid price.

  - bidQuantity, double: the bid quantity.

  - bidReq, long: the number of active bids at this price.

  - offerPrice, double: the offer price.

  - offerQuantity, double: the offer quantity.

  - offerReq, long: the number of active offers at this price.

- MarketBook (output): The input adapter emits tuples on this port when it receives market messages. Each tuple represents a single bid or offer in the market message. Therefore, multiple tuples are normally emitted per market message. The schema of emitted tuples is:

  - currpair, string: the currency pair. For example, EUR/USD.

  - depth, int: the zero-based depth of the bid or offer in the book.

  - totalDepth, int: the total number of bids or offers in the book.

  - isBid, bool: true or false if the tuple represents a bid or offer, respectively.

  - price, double: the bid or offer price.

  - quantity, double: the bid or offer quantity.

  - numReqs, int: the number of active requests at this price.

- Prices (output): The input adapter emits tuples on this port when it receives price messages. The schema of emitted tuples is:

  - currpair, string: the currency pair. For example, EUR/USD.

  - isBid, bool: true or false if the tuple represents a bid or offer, respectively.

  - price, double: the bid or offer price.

  - quantity, double: the bid or offer quantity.

  - numReqs, int: the number of active requests at this price.

  - bankInfo, string: a comma-delimited list of bank information consisting of a bank ID and amount.

  - collatInfo, string: a comma-delimited list of collateral information consisting of a collateral ID and amount

  - seq, long: a unique ID.

- PriceAcks (output): The input adapter emits tuples on this port when it receives price acknowledgement messages. The schema of emitted tuples is:

  - requestId, string: the request ID that was sent to the server.

  - userId, string: the user ID associated with the request.

  - status, int: a status code with one of the following values:

    - 1 — request was accepted

    - 2 — request was rejected due to insufficient margin/credit

    - 3 — remaining amount was cancelled because there is nothing else that it can match against. This status is only sent for buy and sells requests

    - 4 — request was rejected because it was an improper format or invalid currency pair

    - 5 — request was cancelled due to passive only

    - 6 — request was cancelled due to wrong lot size

    - 7 — request was cancelled due to out-of-trading-time

    - 8 — request was cancelled due to disabled user

    - 9 — request was cancelled due to non-tradeable

    - 10 — cancel request was processed successfully

    - 11 — cancel request was rejected because the price is already cancelled or full matched

    - 12 — invalid price

    - 25 — dealing on the counter currency is not allowed for metals

    - 26 — quantities for gold must be even multiples of 100 or quantities for silver must be even multiples of 1000

    - 30 — a pegged order already exists to this side of the market

    - 31 — you can not peg to yourself

    - 32 — the specified side of the market is empty, so has no limit orders to peg

    - 33 — the specified side of the market does not have minimum amount of liquidity to peg. The amount threshold is pre-defined in hotspot marketplace per currency pair.

    - 34 — the stop limit of the pegged order has reached

- PriceCancels (output): The input adapter emits tuples on this port when it receives price cancel messages, indicating the server has moved all the market prices of the specified currency pair for the user. The schema of emitted tuples is:

  - currpair, string: the currency pair. For example, EUR/USD.

  - userId, string: the ID of the user for which the server has removed all market prices for the specified currency pair.

- Trades (output): The input adapter emits tuples on this port when it receives trade messages, indicating matches have occurred in the system. The schema of emitted tuples is:

  - aggressor, int: values of 1 or 2 mean cpty1 or cpty2 was the aggressor, respectively.

  - bidFullMatched, bool: true if the bid was fully matched and false otherwise.

  - ccy1, string: the first currency of the trade. For example, EUR for the currency pair EUR/USD.

  - ccy2, string: the second currency of the trade. For example, USD for the currency pair EUR/USD.

  - cpty1LoginId, string: the short name of counter party 1.

  - cpty1Name, string: the long name of counter party 1 (currently the same as the short name).

  - cpty1ShortName, string: the short name of the counter party 1.

  - cpty1RequestId, string: the user ID of counter party 1.

  - cpty2LoginId, string: the short name of counter party 2.

  - cpty2Name, string: the long name of counter party 2 (currently the same as the short name).

  - cpty2ShortName, string: the short name of the counter party 2.

  - cpty2RequestId, string: the user ID of counter party 2.

  - dealtCcy, string: the dealt currency of the trade. For example, EUR if EUR of EUR/USD is traded.

  - extPriceId, string: client-assigned ID.

  - offerFullMatched, bool: true if the offer was fully matched and false otherwise.

  - price, double: the price at which the trade occurred.

  - quantity1, double: quantity of the deal currency (ccy1) matched, positive or negative if the aggressor bought or sold, respectively.

  - quantity2, double: quantity of the counter currency (ccy2) matched, sign is opposite of quantity1.

  - tradeDate, timestamp: the date on which the trade occurred.

  - tradeId, int: the ID of the trade.

  - tradeType, int: 1 or 2 for regular or administrative trades, respectively.

  - transtime, timestamp: the time at which the trade occurred.

  - valueDate, timestamp: the value date of the trade.

  - isPartialFillable, bool: true if the trade is partially fillable and false otherwise.

- Orders (output): The input adapter emits tuples on this port when it receives order messages. The schema of emitted tuples is:

  - amount, double: the quantity of the order in millions.

  - buySell, string: Buy or Sell.

  - comments, string: user-provided comments.

  - currpair, string: the currency pair. For example, EUR/USD.

  - link, int: 0 for a single order or the ID of the other leg of an OCO order.

  - msg, string: the message from Hotspot trader associated with this request.

  - orderId, string: the order's unique ID.

  - orderType, string: S/L or T/P indicating stop loss or take profit, respectively.

  - price, double: the order price.

  - status, string: the status of the order:

    - Pending — new order request was in pending mode

    - Cxl Pend — cancel order request was in pending mode

    - Mod Pend — amend order request was in pending mode

    - Accepted — order was accepted

    - Rejected — order was rejected

    - Executed — order has been executed

    - Canceled — order has been canceled

- InputEvents (output): The input adapter emits tuples on this port when important events occur. The schema of emitted tuples is:

  - eventType, string: returns one of the following values to convey the type of event:

    - Connection — the connection to the Hotspot server has been established or lost

    - Suspend/Resume — the adapter has been suspended or resumed

  - object, string: an event type-specific value, such as `Hotspot FX` for connection events and the name of the adapter instance for suspend/resume events.

  - action, string: `Connected` or `Disconnected` for connection events and `Suspending` or `Resuming` for suspend/resume events.

  - info, string: a human-readable description of the event.

#### Hotspot FX Output Adapter Ports

The Hotspot FX output adapter sends market requests to the Hotspot FX trading system. It has one input port and two output ports:

- MarketRequest (input): Tuples are enqueued on this port to request market actions such as submitting, amending, or cancelling orders. The schema of incoming tuples is:

  - action, string: Specifies the type of market action being requested, as defined in the table below. Each action has zero or more required parameters passed in additional MarketRequest tuple fields.

    Action | Description | Parameters
    --- | --- | ---
    sendTradeProcessAck | acknowledges receipt of a trade message | tradeId
    sendTradeProcessAckQty | for a partially-fillable trade, acknowledges receipt of a partial amount for execution. Note: this command will be rejected for a non-partially-fillable trade | tradeId, quantity.
    sendTradeProcessNak | sends a negative acknowledgement for a trade message | tradeId
    cancelOrder | Cancels an existing order | orderId
    submitCancel | Cancel the transaction identified by the specified request ID | requestId
    submitCancelAll | cancels all active requests for all currency pairs | None
    submitCancelForCurrencyPair | cancels all active requests for a specific currency pair | currpair
    submitCancelForSingleTransaction | cancels a specific active request | requestId
    submitMarketBuySell | submits a market buy or sell request to be request to be fulfilled at the current market price | currpair, buySell, amount, amtCcy
    submitOrder | submits an order | currpair, buySell, amount, price, orderType, comments
    submitSpotBid | submits a bid | currpair, price, amount, showAmount, amtCcy
    submitSpotBidMinTradeSize | submit a bid with a minimum trading amount | currpair, price, amount, showAmount, amtCcy, minTradeSize
    submitSpotBidOffer | submits a bid and an offer in the same currency pair at the same time to the trading system, cancelling any prices you previously submitted for the same currency pair. Two tuples are emitted on the MarketResponse stream containing the bid and offer request IDs, respectively. | currpair, bidPrice, bidAmount, bidShowAmount, offerPrice, offerAmount, offerShowAmount
    submitSpotBidOfferWithExternalId | submits an offer with an external price id provided by the client that will appear on trades from these prices | currpair, bidPrice, bidAmount, bidShowAmount, offerPrice, offerAmount, offerShowAmount, extPriceId
    submitSpotBuy | submits a buy request to the trading system. If the request cannot be completely fulfilled when it is submitted, the remaining quantity is cancelled and does not remain on the system as an active bid. | currpair, price, amount, amtCcy
    submitSpotBuyMinTradingSize | submits a buy request with a minimum trading size. If the request cannot be completely fulfilled when it is submitted, the remaining quantity is cancelled and does not remain on the system as an active bid. | currpair, price, amount, amtCcy, minTradeSize
    submitSpotOffer | submits an offer | currpair, price, amount, showAmount, amtCcy
    submitSpotOfferMinTradingSize | submits an offer with a minimum trading amount | currpair, price, amount, showAmount, amtCcy, minTradeSize
    submitSpotSell | submits a sell request to the trading system. If the request cannot be completely fulfilled when it is submitted, the remaining quantity is cancelled and does not remain on the system as an active offer. | currpair, price, amount, amtCcy
    submitSpotSellMinTradingSize | submits a sell request with a minimum trading size. If the request cannot be completely fulfilled when it is submitted, the remaining quantity is cancelled and does not remain on the system as an active offer. | currpair, price, amount, amtCcy, minTradeSize

  - amount, long: the quantity used in submitting and amending bid, offer, buy, and sell requests

  - amtCcy, string: the currency the amount is expressed in

  - bidAmount, long: the bid quantity for spot bid/offer requests

  - bidPrice, double: the bid price for spot bid/offer requests

  - bidShowAmount, long: the quantity you wish to show to the rest of the market in bid/offer requests, hiding the true size of your bid

  - buySell, string: `Buy` or `Sell` to indicate whether an order represents a buy or sell request, respectively

  - comments, string: User-supplied comments

  - currpair, string: the currency pair. For example, EUR/USD.

  - extPriceId, string: an external price id provided by the client that will appear on trades from these prices

  - minTradeSize, long: the minimum trading size to use in bid, offer, buy, and sell requests

  - offerAmount, long: the offer quantity for spot bid/offer requests

  - offerPrice, double: the offer price for spot bid/offer requests

  - offerShowAmount, long: the quantity you wish to show to the rest of the market in bid/offer requests, hiding the true size of your offer

  - orderId, string: the ID of an order being amended or cancelled

  - orderType, string: `S/L`, `T/P`, or `OCO` to indicate the type of order being submitted or amended is a stop loss, take profit, or `one cancels the other order`, respectively

  - price, double: the price of a bid, offer, buy, or sell request

  - quantity, double: for a partially-fillable trade, the amount to acknowledge for execution

  - requestId, string: the ID of a single transaction being cancelled

  - sbId, string: a StreamBase application-assigned ID that is echoed in the market response tuple, allowing the application to associate responses with requests

  - showAmount, long: the quantity you wish to show to the rest of the market in bid or offer requests, hiding the true size of your bid or offer

  - tradeId, string: the ID of the trade for which a positive or negative acknowledgement is being sent

- MarketResponse (output): The output adapter emits tuples on this port in response to requests submitted on the MarketRequest port. The schema of emitted tuples is:

  - action, string: The action value from the market request tuple enqueued to the adapter.

  - sbId, string: The StreamBase application-assigned ID from the market request tuple enqueued to the adapter.

  - txId, string: A unique ID assigned to the request by the Hotspot FX trading system. When requesting an action that operates on an existing order (such as amending or cancelling an order), the ID of the existing order is returned.

- OutputEvents (output): The output adapter emits tuples on this port when important events occur. The schema of emitted tuples is:

  - eventType, string: returns one of the following values to convey the type of event:

    - Connection — the connection to the Hotspot server has been established or lost

    - Suspend/Resume - the adapter has been suspended or resumed

    - UserInput - a failure occurred processing a market request input tuple

  - object, string: an event type-specific value, such as `Hotspot FX` for connection events and the name of the adapter instance for suspend/resume events.

  - action, string: `Connected` or `Disconnected` for connection events, `Suspending` or `Resuming` for suspend/resume events, and `Rejected` for user input events.

  - info, string: a human-readable description of the event.

  - inputTuple, tuple: for UserInput events, the market request tuple enqueued to the adapter.

#### Hotspot FX Control Adapter Ports

The Hotspot FX control adapter processes control requests. It has one input port and eight output ports:

- ControlRequest (input): Tuples are enqueued on this port to request control actions such as subscribing to or unsubscribing from market data or getting trade information or order history. The schema of incoming tuples is:

  - action, string: Specifies the type of market action being requested, as defined in the table below. Each action has zero or more required parameters passed in additional MarketRequest tuple fields.

    Action | Description | Parameters
    --- | --- | ---
    getConnectionStatus | Retrieves the state of the connection to the Hotspot FX server. A tuple containing the connection status is emitted on the ConnectionStatus port. | None
    subscribeToHeartbeat | Subscribes to heartbeats such that a heartbeat tuple is emitted on the Heartbeats output port periodically when the connection to the Hotspot FX server is up. | None
    unsubscribeFromHeartbeat | Unsubscribes from heartbeats such that no heartbeat tuples are emitted on the Heartbeats output port, event when the connection to the Hotspot FX server is up. | None
    getHeartbeatSubscriptionStatus | Retrieves the state of heartbeat subscriptions. A tuple containing the heartbeat subscription status is emitted on the Heartbeat status port. | None
    getAllTrades | Retrieves information about all the trades executed. A tuple is emitted on the TradeInfo port for each trade retrieved. | None
    getInitTrades | Retrieves information about all the trades for the current date. A tuple is emitted on the TradeInfo port for each trade retrieved. | None
    getTradesStartingAt | Retrieves information about all the trades starting with the specified trade ID. A tuple is emitted on the TradeInfo port for each trade retrieved. | startTradeId
    getTradesInRange | Retrieves information about all the trades in the specified range. | startTradeId, endTradeId
    isReceivingBestBidAndOfferOnly | Retrieves the current state of a flag indicating whether the full market book is being emitted on the input adapter's MarketBook port or just the best bid and offer in the book. | None
    setReceivingBestBidAndOfferOnly | Sets the flag specifying whether the full market book should be emitted on the input adapter's MarketBook port or just the best bid and offer in the book. | isReceivingBboOnly
    getQueueSize | Retrieves the size of Hotspot FX trading system's message queue holding pending messages to matching engine. A tuple containing the queue size is emitted on the QueueSize output port. | None
    getOutboundQueueSize | Retrieves the size of Hotspot FX trading system's message queue holding pending messages out to the client. A tuple containing the queue size is emitted on the QueueSize output port. | None
    setMinMDSize | Sets the minimum quantity threshold for market data. | minMDSize
    getMinMDSize | Retrieves the minimum quantity threshold for market data. A tuple containing the minimum quantity is emitted on the MinMDSize output port. | None
    getVersion | Retrieves the version of the Hotspot FX API. A tuple containing the version number is emitted on the HotspotVersion output port. | None
    subscribeTo | Subscribes to market information for the specified currency pair. | currpair
    subscribeToAll | Subscribes to market information for all currency pairs. | None
    unsubscribeFrom | Unsubscribes from market information for the specified currency pair. | currpair
    unsubscribeFromAll | Unsubscribes from market information for all currency pairs. | None
    requestOrderHistory | Requests history for an order. | orderId
    connect | Connects to the Hotspot FX server. | None
    disconnect | Disconnects from the Hotspot FX server. | None

  - startTradeId, string: the starting trade ID when requesting trade information.

  - endTradeId, string: the ending trade ID when requesting trade information.

  - orderId, string: the order ID when requesting order history.

  - currpair, string: the currency pair for which market data is subscribed to or unsubscribed from.

  - isReceivingBboOnly, boolean: a flag indicating whether to request the entire market book or just the best bid and offer in the book.

  - minMDSize, double: the minimum quantity threshold for market data.

- ConnectionStatus (output): The control adapter emits tuples on this port in response to getConnectionStatus control requests. The schema of emitted tuples is:

  - isConnected, boolean: `true` if a connection to the Hotspot FX server is up and `false` otherwise.

- HeartbeatStatus (output): The control adapter emits tuples on this port in response to getHeartbeatSubscriptionStatus control requests. The schema of emitted tuples is:

  - isSubscribed, boolean: `true` if the adapter is subscribed to heartbeat tuples and `false` otherwise.

- ReceivingBBOStatus (output): The control adapter emits tuples on this port in response to isReceivingBestBidAndOfferOnly control requests. The schema of emitted tuples is:

  - receivingBbo, boolean: `false` if the adapter is emitting the entire market book on the input adapter's MarketBook port and `true` otherwise.

- QueueSize (output): The control adapter emits tuples on this port in response to getQueueSize and getOutboundQueueSize control requests. The schema of emitted tuples is:

  - size, long: size of Hotspot FX trading system's message queue holding pending messages to the matching engine or client.

  - outbound, boolean: `true` or `false` if the tuple contains the number pending messages to the client or matching engine, respectively.

- MinMDSize (output): The control adapter emits tuples on this port in response to getMinMDSize control requests. The schema of emitted tuples is:

  - size, double: the current minimum market data quantity threshold setting.

- HotspotVersion (output): The control adapter emits tuples on this port in response to getVersion control requests. The schema of emitted tuples is:

  - version, string: the Hotspot FX API version string.

- TradeInfo (output): The control adapter emits tuples on this port in response to getTradesStartingAt and getTradesInRange control requests. The schema of emitted tuples is:

  - aggressor, int: values of 1 or 2 mean cpty1 or cpty2 was the aggressor, respectively.

  - bidFullMatched, bool: true if the bid was fully matched and false otherwise.

  - ccy1, string: the first currency of the trade. For example, EUR for the currency pair EUR/USD.

  - ccy2, string: the second currency of the trade. For example, USD for the currency pair EUR/USD.

  - cpty1LoginId, string: the short name of counter party 1.

  - cpty1Name, string: the long name of counter party 1 (currently the same as the short name).

  - cpty1ShortName, string: the short name of the counter party 1.

  - cpty1RequestId, string: the user ID of counter party 1.

  - cpty2LoginId, string: the short name of counter party 2.

  - cpty2Name, string: the long name of counter party 2 (currently the same as the short name).

  - cpty2ShortName, string: the short name of the counter party 2.

  - cpty2RequestId, string: the user ID of counter party 2.

  - dealtCcy, string: the dealt currency of the trade. For example, EUR if EUR of EUR/USD is traded.

  - extPriceId, string: client-assigned ID.

  - offerFullMatched, bool: true if the offer was fully matched and false otherwise.

  - price, double: the price at which the trade occurred.

  - quantity1, double: quantity of the deal currency (ccy1) matched, positive or negative if the aggressor bought or sold, respectively.

  - quantity2, double: quantity of the counter currency (ccy2) matched, sign is opposite of quantity1.

  - tradeDate, timestamp: the date on which the trade occurred.

  - tradeId, string: the ID of the trade.

  - tradeType, int: 1 or 2 for regular or administrative trades, respectively.

  - transtime, timestamp: the time at which the trade occurred.

  - valueDate, timestamp: the value date of the trade.

- Heartbeats (output): The control adapter emits tuples on this port periodically when heartbeat subscriptions are enabled. The schema of emitted tuples is:

  - time, timestamp: The time of the heartbeat.

- OrderHistory (output): The control adapter emits tuples on this port in response to requestOrderHistory control requests. The schema of emitted tuples is:

  - amount, double: the quantity of the order in millions.

  - buySell, string: Buy or Sell.

  - comments, string: user-provided comments.

  - currpair, string: the currency pair. For example, EUR/USD.

  - link, int: 0 for a single order or the ID of the other leg of an OCO order.

  - msg, string: the message from Hotspot trader associated with this request.

  - orderId, string: the order's unique ID.

  - orderType, string: S/L or T/P indicating stop loss or take profit, respectively.

  - price, double: the order price.

  - status, string: the status of the order:

    - Pending — new order request was in pending mode

    - Cxl Pend — cancel order request was in pending mode

    - Mod Pend — amend order request was in pending mode

    - Accepted — order was accepted

    - Rejected — order was rejected

    - Executed — order has been executed

    - Canceled — order has been canceled

  - userId, string: the user ID associated with the order.

- ControlEvents (output): The control adapter emits tuples on this port when important events occur. The schema of emitted tuples is:

  - eventType, string: returns one of the following values to convey the type of event:

    - Connection — the connection to the Hotspot server has been established or lost

    - Suspend/Resume — the adapter has been suspended or resumed

    - UserInput — a failure occurred processing a control request input tuple

  - object, string: an event type-specific value, such as `Hotspot FX` for connection events and the name of the adapter instance for suspend/resume events.

  - action, string: `Connected` or `Disconnected` for connection events, `Suspending` or `Resuming` for suspend/resume events, and `Rejected` for user input events.

  - info, string: a human-readable description of the event.

  - inputTuple, tuple: for UserInput events, the control request tuple enqueued to the adapter.

### Adding the Adapter to an EventFlow Application

Add an instance of the adapter to a new StreamBase EventFlow application as follows:

1. In StreamBase Studio, create a project, including an empty StreamBase EventFlow application file to host the adapter.

2. From the Operators and Adapter drawer of the Palette view, drag a HotspotInput component to the canvas.

3. From the Operators and Adapter drawer, drag a HotspotOutput component to the canvas.

4. From the Operators and Adapter drawer, drag a HotspotControl component to the canvas.

5. Select the Parameters tab at the bottom of the EventFlow editor. In the Parameters tab, create parameters named `hotspot_server`, `hotspot_port`, `hotspot_username`, `hotspot_password`, and `reconnect_interval`. Enter your site-specific values for each parameter.

6. Select the Editor tab at the bottom of the EventFlow editor.

7. Double-click the HotspotInput adapter icon, and in the Properties view, select the Adapter Settings tab.

8. Enter `${hotspot_server}`, `${hotspot_port}`, `${hotspot_username}`, `${hotspot_password}`, and `${reconnect_interval}` in the corresponding text entry box for each parameter.

9. Repeat the previous two steps for the HotspotOutput and HotspotControl adapter icons.

10. Connect Input and Output Streams to the adapters' input and output ports.

11. Configure the schemas of the input streams with the fields listed in the sections above describing the output and control adapter input ports. Note that the adapter will generate typecheck errors when the input streams are missing required fields, when unexpected fields are present, or when fields are of the wrong type or size.

## Typechecking and Error Handling

The Hotspot FX adapter uses typecheck messages to help you configure the adapter within your StreamBase application. In particular, the adapter generates typecheck messages for the following reasons:

- A required property such as the Hotspot FX server, port, username, or password is missing.

- One or more required fields in an input schema is missing or is of the wrong type or size.

- One or more unexpected fields are present in an input schema.

The adapter generates warning messages during runtime under various conditions, including:

- The adapter fails to connect or loses its connection to the Hotspot FX server.

- A malformed message is received from the Hotspot FX server.

- The adapter incurs an error emitting a tuple.

- The adapter rejects a market or control request.

## Suspend/Resume Behavior

When suspended, the adapter continues to receive and process Hotspot FX messages, but no longer emits tuples on its output ports.

When resumed, the adapter once again starts emitting tuples on its output ports.

### Note

As part of normal adapter shutdown, when the connection from the HotSpot FX server disconnects, the adapter receives several messages from the HotSpot FX server, including a `java.io.OEFException error`. These messages are part of the normal output from the HotspotFX server, and can be safely ignored.

## Related Topics

- Using Embedded Adapters