-
December 26th, 2022, 04:36 AM
#1
How to receive message from client without MetaDataAdapter config
Hi, I want to ask
I create simple chat project and I dont want setup MetaDataAdapter for some reason
I see on Figure 2 in General Concepts and see that DATA PROVIDER can sent data direct to DATA ADAPTER
How to receive those data ? In case cant, write Adapter with Generic without library can do that ? How ?
Thanks for help <3
-
December 26th, 2022, 04:40 AM
#2
And I have some projects that push some data to private address.
As I know, to push data to Lightstreamer, need setup my external api as Lightstreamer client and send data via SendMessage().
But I dont want to modify my api source code ? My solution is create another api, that will listen on private address and this api also is is Lightstreamer client. It will forward data to Lightstreamer via SendMessage() func.
But I have one client only, so this solution is best choice ? Any better solution in my case ?
-
December 27th, 2022, 09:30 AM
#3
Both the "Data Provider" and the "Data Adapter" are custom components.
According to Figure 2, the Data Adapter is a java class written by you, which communicates with the Data Provider (which represents some existing back-end process).
Hence, the way the two parts communicate should depend on the interface offered by the Data Provider. The Data Adapter should obey this interface and "adapt" it to the interface offered by Lightstreamer Server.
On the other hand, if you consider the Generic Adapter SDK, then you refer to a different architecture, shown in the "Adapter Remoting Infrastructure" document, which is a special case of the basic architecture.
In this case, you don't have to add a custom java class to Lightstreamer Server, but you have to setup a remote process which connects to Lightstreamer Server based on the specifications of the ARI protocol.
Then your process is free to communicate with the back-end, but then it should "adapt" the communication to the ARI protocol requirements.
Two ways to achieve the same goal; so you can choose based on your convenience.
That said, please clarify the part of your question related with the Metadata Adapter.
About the second question, if you have "one client only" and need to create "another api", that uses sendMessage, my understanding is that you need to use two LightstreamerClient objects in the same client application or page, which will open two sessions.
This is allowed.
This is not the "best choice", because, if you are bound to "one client only", then keeping the existing LightstreamerClient and integrating the sendMessage on it would be better.
But, as you say "I dont want to modify my api source code", using a second LightstreamerClient objects is still a legal choice.
But please clarify the client environment and the LS SDK in use, to add some context.
-
December 28th, 2022, 04:54 AM
#4
Thanks so much for your answer. It help me a lot <3
-
December 28th, 2022, 06:16 AM
#5
One more question. In my first quest, MetaDataAdapter have a func named notifyUserMessage, will trigger when call sendMessage() from client. In case have a million message send to same time. Everything still work fine because Lightstreamer Kernel will handle it before trigger notifyUserMessage. In case am using Generic Data Adapter, and I no have MetaDataAdapter, how to have a func like this ? I dont want to handle backpressure or any exception from network or client, I want a simple method like notifyUserMessage in MetaDataAdapter, but in DataAdapter, and Lightstreamer will handle all left
-
December 28th, 2022, 08:38 AM
#6
You cannot have no Metadata Adapter. If anything, you can configure the sample Metadata Adapter provided by Lightstreamer (namely the LiteralBasedProvider) and do without authentication and authorization.
In this case, you could rather subclass the LiteralBasedProvider and only handle notifyUserMessage and communicate to the Data Adapter in some custom way to forward the messages.
Setting up this communication may not be easy if the Metadata Adapter is a Java in-process one and the Data Adapter is a remote one based on the Generic Adapters SDK.
Another possibility is that you extend the remote Data Adapter based on the Generic Adapters SDK to also act as a remote Metadata Adapter (and configure adapters.xml accordingly).
In practice, the remote process should open one more connection and, on that, it should obey the ARI protocol for the Metadata Adapter part.
This can be complex, because, on this connection, you will receive many different requests and, even to provide simple answers, you have to handle the syntax.
It would be easier if you could leverage one of the other Remote Adapter SDKs, which take care of the communication protocol and require you to provide a Remote Data or Metadata Adapter object based on a simpler interface, similar to the Java in-process SDK interface.
Then you can have the same process run both the Remote Metadata Adapter and the Remote Data Adapter and have the two objects communicate easily.
We provide a few example of this kind. For instance, the chat adapter for nodejs and the portfolio adapter for C# .net.
In both cases, the Metadata Adapter receives information through notifyUserMessage and shares it with the Data Adapter, which is just a sibling object in the process.
Note that you can have LS Server handle the backpressure for notifyUserMessage also for Remote Metadata Adapters.
In fact, in adapters.xml you can configure the <messages_pool> block; see the inline comment in the adapters.xml template.
-
December 28th, 2022, 10:14 AM
#7
Thanks a lot for your supports. I have my solution
Have a good day <3
Similar Threads
-
By rperseguini in forum Client SDKs
Replies: 2
Last Post: August 19th, 2019, 02:37 PM
-
By jonasby in forum General
Replies: 2
Last Post: May 22nd, 2014, 05:27 PM
-
By gengliangyu2008 in forum General
Replies: 2
Last Post: November 10th, 2010, 10:40 AM
-
By EWANG in forum Client SDKs
Replies: 1
Last Post: June 30th, 2009, 08:54 AM
-
By tuongkha in forum Adapter SDKs
Replies: 2
Last Post: March 18th, 2008, 09:11 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 12:02 AM.
Bookmarks