@MessageConnectorSummary(info="Connects to some url by http or https protocol.", addressFormat="<url>") public class HttpConnector extends AbstractMessageConnector implements HttpConnectorMBean
AbstractMessageConnector.Joinable
Modifier and Type | Field and Description |
---|---|
static String |
CONNECTION_ID_PARAMETER
Connection id parameters might be specified in URL to distinguish multiple
connections that work in a single HTTP session (for example use address like
"http://localhost:9090/sample/QDServlet?connection-id=qdc0").
|
static String |
DEFAULT_CONNECTION_ID
Default connection ID that is used when
CONNECTION_ID_PARAMETER request
property is not specified. |
static int |
DEFAULT_FETCH_COUNT |
static long |
DEFAULT_FETCH_DELAY |
static long |
DEFAULT_UPDATE_DELAY |
protected AbstractConnectionHandler<?> |
handler |
log
Constructor and Description |
---|
HttpConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory,
String address)
Creates new HTTP socket connector.
|
Modifier and Type | Method and Description |
---|---|
String |
getAddress()
Address string of connector.
|
int |
getConnectionCount()
Number of established connections
|
int |
getFetchCount()
Number of times to use fetchDelay after sending piece of data
|
long |
getFetchDelay()
Frequency (in ms) of updating data when data was sent recently
Returns "fetch" delay that is used between subsequent POST requests if any
data was sent upstream.
|
String |
getProxyHost()
HTTP proxy host name
|
int |
getProxyPort()
HTTP proxy port
|
MessageConnectorState |
getState()
State of connector.
|
long |
getUpdateDelay()
Frequency (in ms) of checking if new data is available.
|
protected void |
handlerClosed(AbstractConnectionHandler handler)
Invoked by handler to notify about associated connector about handler's death.
|
boolean |
isActive()
True when connector is active (started).
|
boolean |
isFile()
True in file mode (GET request)
|
com.devexperts.transport.stats.EndpointStats |
retrieveCompleteEndpointStats()
Retrieves endpoint statistics for this message connector since its creation
|
void |
setAddress(String address) |
void |
setFetchCount(int fetchCount) |
void |
setFetchDelay(long fetchDelay)
Sets "fetch" delay.
|
void |
setFile(boolean file) |
void |
setProxyHost(String proxyHost) |
void |
setProxyPort(int proxyPort) |
void |
setStats(QDStats stats)
Sets stats for this connector.
|
void |
setUpdateDelay(long updateDelay)
Sets "update" delay.
|
void |
start()
Starts connector (connection is immediately established).
|
protected AbstractMessageConnector.Joinable |
stopImpl() |
addClosedConnectionStats, addMessageConnectorListener, getClosedConnectionCount, getEndpointStats, getFactory, getLogging, getName, getPassword, getReconnectDelay, getStats, getThreadPriority, getUser, notifyMessageConnectorListeners, reconfigure, reconnect, removeMessageConnectorListener, resetEndpointStats, restart, restartImpl, setFactory, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop, stopAndWait, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEndpointStats, getName, getPassword, getReconnectDelay, getThreadPriority, getUser, reconnect, resetEndpointStats, restart, setName, setPassword, setReconnectDelay, setThreadPriority, setUser, stop
awaitProcessed
public static final String CONNECTION_ID_PARAMETER
public static final String DEFAULT_CONNECTION_ID
CONNECTION_ID_PARAMETER
request
property is not specified.public static final int DEFAULT_FETCH_COUNT
public static final long DEFAULT_FETCH_DELAY
public static final long DEFAULT_UPDATE_DELAY
protected volatile AbstractConnectionHandler<?> handler
public HttpConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory, String address)
factory
- application connection factory to useaddress
- address HTTP address to connect toNullPointerException
- if factory
or address
is null
public String getAddress()
MessageConnectorMBean
getAddress
in interface MessageConnectorMBean
public void setAddress(String address)
setAddress
in interface HttpConnectorMBean
public int getFetchCount()
HttpConnectorMBean
getFetchCount
in interface HttpConnectorMBean
public void setFetchCount(int fetchCount)
setFetchCount
in interface HttpConnectorMBean
public long getFetchDelay()
HttpConnectorMBean
getFetchDelay
in interface HttpConnectorMBean
public void setFetchDelay(long fetchDelay)
HttpConnectorMBean
HttpConnectorMBean.getFetchDelay()
.setFetchDelay
in interface HttpConnectorMBean
fetchDelay
- see HttpConnectorMBean.getFetchDelay()
public long getUpdateDelay()
HttpConnectorMBean
getUpdateDelay
in interface HttpConnectorMBean
public void setUpdateDelay(long updateDelay)
HttpConnectorMBean
HttpConnectorMBean.getUpdateDelay()
.setUpdateDelay
in interface HttpConnectorMBean
updateDelay
- see HttpConnectorMBean.getUpdateDelay()
public String getProxyHost()
HttpConnectorMBean
getProxyHost
in interface HttpConnectorMBean
public void setProxyHost(String proxyHost)
setProxyHost
in interface HttpConnectorMBean
public int getProxyPort()
HttpConnectorMBean
getProxyPort
in interface HttpConnectorMBean
public void setProxyPort(int proxyPort)
setProxyPort
in interface HttpConnectorMBean
public boolean isFile()
HttpConnectorMBean
isFile
in interface HttpConnectorMBean
public void setFile(boolean file)
setFile
in interface HttpConnectorMBean
public void start()
MessageConnectorMBean
start
in interface MessageConnectorMBean
start
in class AbstractMessageConnector
protected AbstractMessageConnector.Joinable stopImpl()
stopImpl
in class AbstractMessageConnector
protected void handlerClosed(AbstractConnectionHandler handler)
AbstractMessageConnector
Recommended implementation template:
- check if handler is still actual (beware of asynchronous execution) and cut-out local handler reference
- restart processing (if needed)
handlerClosed
in class AbstractMessageConnector
handler
- - the notifying handlerpublic void setStats(QDStats stats)
QDStats.SType#HTTP_CONNECTOR
or
a suitable substitute. This method may be invoked only once.setStats
in interface MessageConnector
setStats
in class AbstractMessageConnector
IllegalStateException
- if already set.public boolean isActive()
MessageConnectorMBean
isActive
in interface MessageConnectorMBean
public MessageConnectorState getState()
MessageConnectorMBean
getState
in interface MessageConnectorMBean
public int getConnectionCount()
MessageConnectorMBean
getConnectionCount
in interface MessageConnectorMBean
public com.devexperts.transport.stats.EndpointStats retrieveCompleteEndpointStats()
MessageConnectorMBean
retrieveCompleteEndpointStats
in interface MessageConnectorMBean
retrieveCompleteEndpointStats
in class AbstractMessageConnector
Copyright © 2002-2020 Devexperts LLC. All Rights Reserved.