[Spring Graphql] Knowing which fields are requested by a query/subscription? #3444
-
|
I'm trying to make a GraphQL interface on top of the data coming from a very slow physical device (I have both a solar converter and a heatpump that both only speak modbus). The root problem I have is that these devices have many fields available (my solarconverter has a few hundred fields) and there is a limit on modbus of a maximum of only 125 fields per call. On some of my devices such a call sometimes takes almost a second. To allow getting the data as often as possible I want to only fetch the fields from the real device for which there is an actual need in either a query or subscription. In a related project (not modbus, so I get the full record in all cases) I have used the Spring Graphql library and used a QueryMapping and a SubscriptionMapping to implement the query and subscription. This works fine but I do not see a way to get the data I think I need. For the modbus case I see a need to have
The only example code I have found so far that does something like this was this ~7 year old StockTickerWebSocket example. What I'm looking for a some guidance going into the right direction.
In all of the above: Any example/javadoc/code link that points me towards how to do this is highly appreciated. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The bottom of this article is about you need I believe. I tried it a few weeks ago in a Spring 3 app and the context includes the fields got queried. |
Beta Was this translation helpful? Give feedback.
The bottom of this article is about you need I believe. I tried it a few weeks ago in a Spring 3 app and the context includes the fields got queried.