graphql mesh execute query programatically - graph

I am using the graphql-mesh as gateway to connect and get data from some internal resources. I want to use this mesh query programatically so from other rest handler I can execute any query from my mesh gateway. Is there any way to do this

You can use Mesh's execute function, as shown here

Related

How to fetch data of a a vertex or an edge from JanusGraph using its Java driver?

I'm connecting to a remote JanusGraph server. There is no problem with the connection but I can't understand the Java API.
I'm running a Java Spring HTTP server. Inside the HTTP response method, I'm creating a graph traversal source like
GraphTraversalSource g = traversal().withRemote("conf/remote-graph.properties");
It seems fine. But When I want to get data about a Vertex I can not with the below code.
g.V(28712).next().keys()
IT GIVES AN EMPTY RESPONSE! WHY?
If I do the same with gremlin shell, I see it. See the below picture
If I do g.V(28712).valueMap(true).unfold().toList(); in Java, I see some results.
I just want to fetch data for a vertex or edge with Java. How should I do that?
thanks
By default, when you connect to a Gremlin Server using one of the Gremlin clients and you ask for a vertex, what you get back is a reference vertex. A reference vertex just contains the ID and the label. To get some properties you need to include them using valueMap, elementMap, project etc. Alternatively you can configure the Gremlin Server to return all properties. The default is set this way to reduce the amount of data that gets sent back to a client.
Please see the documentation for further details.
https://tinkerpop.apache.org/docs/current/reference/#gremlin-applications
https://tinkerpop.apache.org/docs/current/reference/#_properties_of_elements
There is a link in that documentation to a post about why the decisions were made. For convenience, I am including that link here as well.
https://lists.apache.org/thread.html/e959e85d4f8b3d46d281f2742a6e574c7d27c54bfc52f802f7c04af3%40%3Cdev.tinkerpop.apache.org%3E

Freeswitch Guide how to get CDR UUID from client side

My system contain:
- Freeswitch server
- Sip Client: Web using sipjs , mobile react-native using https://github.com/datso/react-native-pjsip to receive call.
My problem is when call done i need to know the uuid of CDR recently add to Postgres DB of that call to attach some info to that call
I try many way but can not success ex: write http request to select into postgres DB, but can not find exactly which uuid because one extension can make many call one time.
Can anyone help me solve this case?
Mark each call with custom variable like callid
Send that to your app via any method, as sipheader, as sip message, using http post etc.
But you also can just search cdr by start date.

Connecting database from flow

How should I need to connect with the database from flow to fetch the data instead of vault querying?
1.Instead of using custom query criteria, I am planning to use query command(like SQL command) to fetch the data from database.
2.Is it possible?
3.If it is possible, how to achieve it?
serviceHub.jdbcSession().prepareStatement() or serviceHub.withEntityManager { }

Save values global in NodeRED

We are working with MQTT messages, process these messages and call a REST service to send the information to another system.
Now we need to save some values from the MQTT message to compare these values with other messages. Is it possible to create an array that is outside the workflow that can be accessed from other workflows? Currently we are saving the values to a file but this is not the way we want to do it.
Sounds like you need either an external database or a keyvalue store.
There a lots of database nodes for Node-RED that could do this or for a keyvalue pair you can use something like redis.
You can search on https://flows.nodered.org for database and redis nodes.
You can set global variables however they won't be retained when you restart node-red. Here's an example for you.
[{"id":"5a6c6b8.2487294","type":"inject","z":"98c20df4.95abc","name":"","topic":"","payload":"val1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":260,"wires":[["e62b621d.37897"]]},{"id":"f83255b0.19aa48","type":"inject","z":"98c20df4.95abc","name":"","topic":"","payload":"val2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":300,"wires":[["e62b621d.37897"]]},{"id":"e62b621d.37897","type":"change","z":"98c20df4.95abc","name":"","rules":[{"t":"set","p":"testvar","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":280,"wires":[[]]},{"id":"c99e3c90.ae63d","type":"inject","z":"98c20df4.95abc","name":"","topic":"","payload":"val1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":400,"wires":[["a72eed82.28ddd"]]},{"id":"940128d3.c5d0a8","type":"inject","z":"98c20df4.95abc","name":"","topic":"","payload":"val2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":440,"wires":[["a72eed82.28ddd"]]},{"id":"a72eed82.28ddd","type":"function","z":"98c20df4.95abc","name":"","func":"var compare = global.get(\"testvar\");\n\nif(typeof(compare)=='undefined'){\n //Good idea to check if it's been set so you don't get 'undefined' errors\n node.status({text:\"Global var has not been set yet\"});\n}else if(msg.payload == compare){\n node.status({text:\"Same\"});\n}else{\n node.status({text:\"NOT the same\"});\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":767.01953125,"y":415.00390625,"wires":[[]]},{"id":"997cc65f.c8d238","type":"comment","z":"98c20df4.95abc","name":"Set the Global var here","info":"","x":560,"y":220,"wires":[]},{"id":"34e55934.227c16","type":"comment","z":"98c20df4.95abc","name":"Test the Global var here","info":"","x":560,"y":360,"wires":[]},{"id":"81bed25f.6022a","type":"inject","z":"98c20df4.95abc","name":"","topic":"","payload":"val1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":560,"wires":[["164c525e.b4f6ce"]]},{"id":"d03c41c8.088a","type":"inject","z":"98c20df4.95abc","name":"","topic":"","payload":"val2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":600,"wires":[["164c525e.b4f6ce"]]},{"id":"a4cd5575.a4cef8","type":"comment","z":"98c20df4.95abc","name":"Another way to set the Global var","info":"","x":590,"y":520,"wires":[]},{"id":"164c525e.b4f6ce","type":"function","z":"98c20df4.95abc","name":"","func":"global.set(\"testvar\",msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"x":770,"y":580,"wires":[[]]}]
Try node-red-contrib-state it persists state across node-red restarts, and has a few other tools for state management.
mqtt is also good for saving state if you have access to an mqtt broker.

Is there a way to update the ESB ALL.Exceptions send port to use the WCF.SQL adapter?

The ESB Toolkit 2.1 has the ALL.Exceptions send port using the old SQL adapter.
But the BizTalk Health Monitor reports ...
Non WCF SQL adapter used in some Send Ports
Prefer to use the WCF one which is more performant !
Is there any way to update to the WCF.SQL adapter?
Yes this is possible. It will however include some custom development.
You will need to create a map between the FaultMessage schema (in Microsoft.Practices.ESB.ExceptionHandling.Schemas.Reporting.dll) and the usp_insert_Fault schema (created using the Consume Adapter Service in Visual Studio, from the usp_insert_Fault SP in the EsbExceptionDb database), as the old SQL Adapter uses a different schema layout to execute a stored procedure.
Required Steps:
Change the Transport Type of the ALL.Exceptions port to WCF-SQL
Set the Address: mssql://SQLServer:1433/SQLInstance/EsbExceptionDb?
Set the Action: TypedProcedure/dbo/usp_insert_Fault
Change the ESBFaultProcessor Send Pipeline to use your custom map in the ESB Transform Component
EDIT: Note: The solution described here does not include the Message and its Context like the map with the SQL Adapter does. To accomplish this, you should make use of Composite Operation to insert into multiple tables in one transaction.

Resources