Skip to content
Data > Feed Handlers

AMPS

3forge supports AMPS integration in one of two ways:

  • AMPS datasource adapter
  • AMPS feed handler

This is the page for the AMPS feed handler. To set up the datasource adapter, see this page.

Overview

The AMPS feed handler connects and subscribes to an AMPS server at startup using the AMPS Command Interface. It provides low-latency streaming of AMPS data into AMI for easy realtime data visualization.

Note

The feed handler enables one-way subscription of AMPS data into AMI. To send commands and queries to AMPS, you will also need to configure the datasource adapter.

To subscribe and receive real-time data only, e.g: making realtime visualizations, the feed handler is sufficient.

There are a list of configurable properties that need to be set in local.properties which configure the AMPS commands' command id, topic, option, filter, etc.

Setup

Requirements

  • An AMPS server and its connection details
  • The AMPS feed handler

Configuration

For each AMPS feed, you will need a dedicated named AMPS feed handler. Add the following properties to your local.properties file, changing your alias(es) accordingly:
ami.relay.fh.active=$${ami.relay.fh.active},amps1
ami.relay.fh.amps1.class=com.f1.ami.relay.fh.amps.AmiAmpsFH 

Then, for each AMPS feed handler, configure and include all the properties in the available properties list below.

Available Properties

These are the available configurable properties for AMPS. Each AMPS feed handler you have needs to have these properties configured.

Note

These properties assume the feed handler alias is "amps1". You will need a new set of properties for each feed handler and each alias should be unique.

Required

# References existing list of feed handlers. Add the alias(es) for your AMPS feed handler(s)
ami.relay.fh.active=$${ami.relay.fh.active},amps1

# Feed handler class for AMPS as supplied by 3forge. Must be exact
ami.relay.fh.amps1.class=com.f1.ami.relay.fh.amps.AmiAmpsFH 

# AMPS URL 
ami.relay.fh.amps1.props.url=tcp://flux.3forge.net:9007/amps/nvfix 

# AMPS topic(s) to subscribe to
ami.relay.fh.amps1.props.topics= 

# Client name when logging into AMPS, default is AMPS2AMIRELAY. Note, this must be unique for each client
ami.relay.fh.amps1.props.clientname=AMPS2AMIRELAY

Optional

# Default is true. Set to false to disable this feed handler
ami.relay.fh.amps1.start=true

# Overrides the application id(1) that messages coming from this feed handler will be mapped to. Default is the handler name, which in this case is amps1
ami.relay.fh.amps1.props.amiId=amps1 

# Comma-delineated AMPS filter(s). One filter expression per topic
ami.relay.fh.amps1.props.filters=

# AMPS command(s) to send on startup. Default is sow_and_delta_subscribe
ami.relay.fh.amps1.props.commands=sow_and_delta_subscribe

# AMPS option(s) for command, oof (out of focus) is default. If supplied, there must be the same count as topics
ami.relay.fh.amps1.props.options=oof

# AMPS timeout for commands, default is 60000
ami.relay.fh.amps1.props.timeout=60000

# AMPS batchsizes, default is 10000
ami.relay.fh.amps1.props.batchsize=10000

# What should AMPS sow key be mapped to, default is I. Use blank string for no mapping
ami.relay.fh.amps1.props.sow_key_mappings=I

  1. See the __CONNECTION table docs for explanation on application ids.

Examples

Minimal Config

1
2
3
4
5
ami.relay.fh.active=$${ami.relay.fh.active},amps1
ami.relay.fh.amps1.class=com.f1.ami.relay.fh.amps.AmiAmpsFH
ami.relay.fh.amps1.props.clientname=AMPS2AMIRELAY
ami.relay.fh.amps1.props.url=tcp://localhost:9007/amps/json
ami.relay.fh.amps1.props.topics=TOPIC1

Multiple Topics with Filters

1
2
3
4
5
6
ami.relay.fh.active=$${ami.relay.fh.active},amps1
ami.relay.fh.amps1.class=com.f1.ami.relay.fh.amps.AmiAmpsFH
ami.relay.fh.amps1.props.clientname=AMPS2AMIRELAY
ami.relay.fh.amps1.props.url=tcp://localhost:9007/amps/json
ami.relay.fh.amps1.props.topics=ORDERS,EXECUTIONS
ami.relay.fh.amps1.props.filters=/status='open' and /price > 100,/MsgType='fill'

Note

AMI requires a mapping between columns and values and will assign this automatically. To pass raw values without specific mappings, use the optional flag _mode.

E.g, in a datamodel: use ds="amps" _mode="raw" insert into `messages` values ("a=b\;c=d\;f=22ff");

Logs

Search for com.f1.ami.relay.fh.amps.AmiAmpsFH in the AmiOne.log file (found in amione/log by default) for information regarding configuration, initialization of the adapter, sending of AMPS commands, and any errors.

For Example:
grep com.f1.ami.relay.fh.amps.AmiAmpsFH log/AmiOne.log

Returns:

1
2
3
ami.relay.fh.amps1.class=com.f1.ami.relay.fh.amps.AmiAmpsFH
INF 20190704-09:17:32.802 EST5EDT [main] com.f1.ami.relay.AmiRelayServer::initFH Initializing fh - com.f1.ami.relay.fh.amps.AmiAmpsFH@42a3abe9
INF 20190704-09:17:32.964 EST5EDT [amps connector] com.f1.ami.relay.fh.amps.AmiAmpsFH::run executed command=sow_and_delta_subscribe, topic=FIXMSG, filter=null, options=oof, timeout=60000, batchSize=10000, sowkeymap=I

If you'd like to log each message received from AMPS, add the following to your local.properties:

speedlogger.stream.com.f1.ami.relay.fh.amps.AmiAmpsFH=BASIC_APPENDER;FILE_SINK;FINE

And you will start seeing message in the format:

FNE 20190704-09:23:57.909 EST5EDT [AMPS Java Client Background Reader Thread 86] com.f1.ami.relay.fh.amps.AmiAmpsFH::invoke AMPS Message received: Message{ ... }