|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dxfeed.api.DXEndpoint
public abstract class DXEndpoint
DXEndpoint
manages network connections to data feed
or to
publisher
. There are factory methods create()
and
create(Role)
, and a number of configuration methods.
DXFeed feed =SeeDXEndpoint
.create
().connect
("demo.dxfeed.com:7300").getFeed
();
DXFeed
class to learn how to subscribe to symbols and to receive events.
create()
creates an endpoint with a FEED
role.
Endpoints with other roles are created with create(Role)
factory method. Endpoint role is
represented by DXEndpoint.Role
enumeration.
Endpoint role defines the behavior of its connect
method:
FEED
connects to the remote data feed provider. getFeed()
method returns
a feed object that subscribes to this remote data feed provider and receives events from it.
For example:
DXEndpoint.create().connect("demo.dxfeed.com:7300").getFeed()
returns a
demo feed from dxFeed with sample market quotes.DXEndpoint.create().connect("localhost:7400").getFeed()
returns a feed
that is connected to a publisher that is running on the same host. See example
below.PUBLISHER
connects to the remote publisher hub (also known as multiplexor) or
creates a publisher on the local host. getPublisher()
method returns
a publisher object that publishes events to all connected feeds. For example:
DXEndpoint.create(DXEndpoint.Role.PUBLISHER).connect(":7400").getPublisher()
returns a
publisher that is waiting for connections on TCP/IP port 7400. The published events will be
delivered to all feeds that are connected to this publisher.LOCAL_HUB
creates a local hub without ability to establish network connections.
Events that are published via publisher
are delivered to local
feed
only.
Nested Class Summary | |
---|---|
static class |
DXEndpoint.Role
Role represents the role of this endpoint that was specified during its creation . |
static class |
DXEndpoint.State
State represents the stat of this endpoint. |
Constructor Summary | |
---|---|
DXEndpoint()
|
Method Summary | |
---|---|
abstract void |
close()
|
abstract DXEndpoint |
connect(java.lang.String address)
Connects to the specified remove address. |
static DXEndpoint |
create()
Creates an endpoint with FEED role. |
static DXEndpoint |
create(DXEndpoint.Role role)
Creates an endpoint with a specified role. |
abstract void |
disconnect()
Closes all remote network connections. |
abstract DXEndpoint |
executor(java.util.concurrent.Executor executor)
Changes executor that is used for notifications. |
abstract DXFeed |
getFeed()
|
abstract DXPublisher |
getPublisher()
|
abstract DXEndpoint.Role |
getRole()
Returns the role of this endpoint. |
abstract DXEndpoint.State |
getState()
Returns the state of this endpoint. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DXEndpoint()
Method Detail |
---|
public static DXEndpoint create()
FEED
role.
The result of this method is the same as create(DXEndpoint.Role.FEED)
.
public static DXEndpoint create(DXEndpoint.Role role)
role
- the role.
public abstract DXEndpoint.Role getRole()
DXEndpoint
public abstract DXEndpoint.State getState()
DXEndpoint
public abstract DXEndpoint executor(java.util.concurrent.Executor executor)
executor
- the executor.
DXEndpoint
java.lang.NullPointerException
- if executor is null.public abstract DXEndpoint connect(java.lang.String address)
address
- data source address.
DXEndpoint
java.lang.NullPointerException
- if address is null.public abstract void disconnect()
public abstract void close()
public abstract DXFeed getFeed()
public abstract DXPublisher getPublisher()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |