All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quotemedia.streamer.client.package-info Maven / Gradle / Ivy

Go to download

Java streaming client that provides easy-to-use client APIs to connect and subscribe to QuoteMedia's market data streaming services. https://quotemedia.com/

The newest version!
/**
 * Provides streaming service client core types.
 *
 * 

Streams can be created using {@link com.quotemedia.streamer.client.StreamFactory}. * *

 * Config cfg = ...
 *
 * StreamFactory f = new StreamFactory(cfg);
 *
 * Stream s = f.create();
 *
 * // Set callback to receive messages.
 * s.onmessage( new OnMessage{@literal }() {
 *     public void on(final DataMessage msg) {
 *         // Do something useful with data
 *     }
 * }
 *
 * // Set callback to receive errors.
 * s.onerror( new OnError() {
 *     public void on(StreamException e) {
 *         // Handle error if possible
 *     }
 * }
 * 
* *

Then the stream can be opened. * *

 * StreamCfg params = ...
 *
 * try {
 *     ConnectResponse r = s.open(params);
 * } catch(StreamException e) {
 *     // Connection failed abort
 * }
 *
 * if(r.getCode() != ResponseCodes.OK_CODE) {
 *     // Handle unsuccessful connect response
 * }
 * 
* *

An open stream can subscribe for streaming data. * *

 * Subscription request = new Subscription.Builder()
 *     .symbols("ACME")
 *     .types(Datatype.QUOTE, Datatype.PRICEDATA);
 *
 * // Subscribe request is asynchronous response/exception is handled in callback
 * s.subscribe(request, new OnResponse{@literal }() {
 *         public void response(SubscribeResponse r) {
 *             // Handle response
 *         }
 *
 *         public void error(Exception e) {
 *             // Handle exception if possible
 *         }
 *     }
 * 
* *

Once the stream isn't needed anymore close it. * *

 * // Close request is asynchronous, callback is called once the stream is closed
 * s.close(new OnClose() {
 *         public void closed() {
 *             // Handle close
 *         }
 *     }
 * 
*/ package com.quotemedia.streamer.client;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy