Alessandro Alinone
Starting from ARI v.1.4 build 42 (which ships with Lightstreamer Server v.3.6) a new Proxy Metadata Adapter has been released, which includes auto-recovery capabilities. In other words, the life cycle of Lightstreamer Server is no more necessarily bound to the life cycle of the Remote Metadata Adapters.
The new Proxy Metadata Adapter class is named RobustNetworkedMetadataProvider.
Below is the template for the <metadata_provider> section of the adapters.xml configuration file, which includes inline documentation of the new recovery features.
[SYNTAX="XML"] <metadata_provider>
<!-- Mandatory. The RobustNetworkedMetadataProvider communicates with
its remote counterpart through standard TCP sockets. It listens
on a specific port and waits for its counterpart to connect.
Moreover, this Metadata Adapter manages the case in which the remote
counterpart is missing, by just refusing all new requests from the
clients and storing all state change notifications that have to be
sent to the backend (namely, session closing and table closing
notifications).
Meanwhile, this Metadata Adapter keeps waiting for a connection
from a new remote server; upon connection, it will flush pending
notifications, then start working normally. -->
<adapter_class>com.lightstreamer.adapters.remote.metadata.RobustNetworkedMetadataProvider</adapter_class>
<!-- Mandatory for NetworkedMetadataProvider. The request/reply port to listen on. -->
<param name="request_reply_port">6663</param>
<!-- Optional, specific for RobustNetworkedMetadataProvider.
The timeout for reconnection attempts. After an unsuccessful attempt
by a remote server to connect to this Proxy Adapter, the Adapter can
retry accepting more connection attempts after waiting for this time.
A negative value prevents further attempts, so that no remote server
will be available.
Default: -1. -->
<param name="connection_recovery_timeout_millis">10000</param>
<!-- Optional, specific for RobustNetworkedMetadataProvider.
The timeout for the first connection attempt. Upon the Proxy Adapter
initialization at Lightstreamer Server startup, if a remote server
is not available, Lightstreamer Server startup can be delayed until
this timeout expires.
A negative value stands for an unlimited timeout.
Note that, as soon as Lightstreamer Server startup completes,
until a connection to a remote server is still missing, all client
requests will be refused.
Default: -1. -->
<param name="first_connection_timeout_millis">10000</param>
<!-- Optional, specific for RobustNetworkedMetadataProvider.
The strategy to be adopted whenever a new remote server is available
in order to resend the state change notifications that could not
or might not have been sent to the previous remote server.
This involves the notifications of session closing and the optional
notifications of table closing.
Note that the Proxy Adapter has no way of knowing exactly if a
notification has been processed by a remote server if no answer
had been received at the time the connection was closed. Also
Consider that the answers from the remote server are not expected
to come in the same sequence as the requests.
Hence, no perfect recovery is possible and the remote server must
be able to deal with an imperfect notification sequence.
Currently, the only available options are:
- pessimistic
All notifications since the first one that could not or may not
have been processed by the previous remote server are resent
to the new one.
This ensures that all notifications are processed at least once,
but may cause some notifications to be issued for a second time.
Even notifications that did get an answer could be resent,
in order to preserve the original sequence.
Note that timed out requests (see the "timeout" setting) are
considered as processed.
- optimistic
Only notifications after the last one that got an answer by the
previous remote server are resent to the new one.
- unneeded
No notifications are resent. In case the close notifications
are ignored by the remote server implementation, this can save
a possibly long playback of unneeded messages.
Note that table notifications, for both opening and closing, are
already omitted, unless requested by the remote server through
the wantsTablesNotification method.
Default: pessimistic. -->
<param name="close_notifications_recovery">unneeded</param>
<!-- Optional. The local network interface to bind to.
If not specified, it will bind to any available interface. -->
<!--
<param name="interface">192.168.1.1</param>
-->
<!-- Optional. Name of the Proxy Metadata Adapter, to better identify its threads when
assessing problems. If not specified, it will be assigned a progressive number. -->
<!--
<param name="name">MyFeedMetadata</param>
-->
<!-- Optional. Timeout for sent requests. A negative value stands for
an unlimited timeout.
Timed out requests are considered as failed and later answers are
ignored.
Default: 10000 ms (10 seconds). -->
<!--
<param name="timeout">10000</param>
-->
<!-- Optional. If set to false, suppresses clearing of the cached profile data
for a user when no sessions for the user are active. This is only for
troubleshooting purpose, as profile data are always refreshed upon
notifyUser requests.
Default: true. -->
<!--
<param name="clear_on_session_close">true</param>
-->
<!-- Optional. Sets the minimum time (in milliseconds) cached profile data are kept;
these cached data are needed in order to manage request processing before a session
is fully started. Ignored if clear_on_session_close is false.
Default: 10000 ms (10 seconds). -->
<!--
<param name="user_data_timeout">1000</param>
-->
</metadata_provider>[/SYNTAX]
AidasOzelis
Hi,
I'm getting the following error when trying to load robust metadata provider (LS running as a Windows Service):
26-May-10 16:17:01,758 |ERROR|LightstreamerLogger.init |WrapperSimpleAppMain |Error while loading the Adapters
java.lang.Exception: Unexpected error in Metadata Adapters initialization
at com.lightstreamer.i.gb.b(gb.java)
at com.lightstreamer.i.gb.c(gb.java)
at com.lightstreamer.i.cb.a(cb.java)
at com.lightstreamer.a.xc.run(xc.java)
Caused by: java.lang.NoSuchMethodError: com.lightstreamer.adapters.remote.metadata.NetworkedMetadataProvider.initEmpty(Ljava/util/Map;Ljava/io/File :Smile_Ad: V
at com.lightstreamer.adapters.remote.metadata.RobustNetworkedMetadataProvider.init(RobustNetworkedMetadataProvider.java:76)
... 4 more
if I change configuration back to the LiteralBasedProvider it works fine.
Dario Crivelli
The ls-proxy-adapters.jarlibrary that contains RobustNetworkedMetadataProvider should also contain the version of NetworkedMetadataProvider that was compiled together with it.
So, it seems that your Server configuration contains both the old and the new version of ls-proxy-adapters.jarand the Server loads the old version of NetworkedMetadataProvider . May you please check?
Note that Lightstreamer Server does not offer ClassLoader separation between different Adapter set configurations.