Getting Started With AMPS Configuration
This section describes one typical process for developing an AMPS configuration file.
Add mandatory information
An AMPS configuration starts with an
AMPSConfig
element at the outermost level of the configuration. Every AMPS instance must have aName
. This name identifies the instance, and must be unique within a set of instances.In this case, we can define the name
test-AMPS-1
for the instance.With this configuration AMPS will start but will not allow any incoming connections to process messages. This instance also does not provide any monitoring or logging.
Describe how AMPS will receive connections from applications
AMPS has no default settings for receiving commands from applications or for delivering messages to applications.
To enable applications to connect to AMPS, specify a
Transports
element that defines one or more incomingTransport
definitions. These are described in detail in the Transports section of this guide.For example, it's common to define one transport for application connections, and one transport for the use of web applications (JavaScript / TypeScript) and data queries or subscriptions from the Galvanometer admin tool.
In this case we'll allow browser-based applications (such as Galvanometer) to connect to port
9008
, and applications that use the other client libraries to connect to port9007
.After this step, the configuration might look something like this:
Enable administrative monitoring.
AMPS does not enable administrative monitoring by default. However, all instances of AMPS should enable this, as described in the Admin Server and Statistics section.
For sample purposes, we will use port 8085 to host the administrative interface and Galvanometer. This configuration also tells Galvanometer to use the
any-ws
transport for the embedded JavaScript client.Enable error and event logging
Last, but not least, it's important to be notified of any errors or important events in AMPS. AMPS does not enforce any default for this logging, but instead requires this logging to be explicitly configured.
For a production instance, AMPS would typically log messages to a file. For a quick sample, though, we can just log anything at
warning
level or above tostdout
.Define advanced messaging behavior
The configuration in the four sections above is all you need for basic subscribe and publish functionality.
For more advanced functionality, you configure AMPS to provide that functionality. For example, to configure a last-value-cache for a topic, you would define a
Topic
in the State of the World. To enable full, message-by-message replay for a topic or set of topics, you would define a Transaction Log.
All instances of AMPS, regardless of the application they support, should follow this minimum outline: define the instance Name
, the instance Transports
, define monitoring through the Admin
console, and specify the Logging
for the instance.
Most applications also take advantage of the advanced messaging capabilities of AMPS, as described in detail in the AMPS User Guide. The Scenario and Feature Reference of the Introduction to AMPS can help to suggest starting points for different scenarios.
Last updated