Skip to Content
0

New entry in hana table send using websocket

Oct 20, 2017 at 10:06 AM

86

avatar image
Former Member

Dear All,

I would like to know if it's possible when I have a new entry in my hana table to send this entry with websocket ?

If yes how to do it ? (Java application or XS app )?

Thanks and regards

10 |10000 characters needed characters left characters exceeded

Hello Jonathan,

if I understood your question correctly, you are using "Internet of Things for Neo environment" [1] where you have your IoT Message Type configured and the Device is sending messages to the IoT MMS using that defined format. Now you want to extend your Message Type with an additional field and would like your existing T_IOT_ table also be extended, right?

Please elaborate a bit.

Regards,

Anton

[1] https://help.sap.com/viewer/product/SAP_CP_IOT_2.0/Cloud/en-US

0
Former Member

Hi Anton,

Yes I'm using IOT to receive message and store it in my an HANA table this part work correctly.
But now that I want is, when I receive a new message from my IOT device, publish throught a websocket the new message stored in my table.

Is it more clear?

Thanks for your help :)

0

Could you please rephrase this sentence "But now that I want is, when I receive a new message from my IOT device, publish throught a websocket the new message stored in my table." in other words please?

0
Former Member

Sorry Anton :)

Actually I receive message from different IOT device and the data sent are stored in my table on HANA.

My goal is: when a new entry on on my table is performed I want to publish this new entry throught a websocket

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Anton Levin
Oct 20, 2017 at 04:09 PM
1

Hello Jonathan,

so, based on your additional comments above, the use case you describe is: react on incoming messages from the device (new entries in the table) and then do some action (forward new entry via WS).

First part of the use case reminds me some similar threads [1], [2], [3] from the Community archive. Summarizing those ones, you have basically two options:

  1. Make use of HANA Triggers [4] and react on new entries in the DB table.
  2. Configure IoT HTTP Message Processing (Message Forwarding) [5] in addition to the default SQL one, so that your device messages are also forwarded to some arbitrary HTTP endpoint (implemented by you).

As for the second part (forwarding an entry via WS):

  1. In case of HANA Triggers I am not quite sure if XS is able to establish WS connectivity (never tried it myself).
  2. In case of HTTP endpoint, you are free to implement WS connectivity yourself. It is completely on you what to do when you receive the forwarded message from IoT MMS.

Hope this helps.

Regards,

Anton

[1] https://archive.sap.com/discussions/thread/3891613

[2] https://archive.sap.com/discussions/thread/3828005

[3] https://archive.sap.com/discussions/thread/3897617

[4] https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.00/en-US/20d5a65575191014946db96aaedbef5b.html

[5] https://help.sap.com/viewer/7436c3125dd5491f939689f18954b1e9/Cloud/en-US/65055489297046f3808757aa7eeb779d.html

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks Anton,

I will try and let you inform :)

Thanks for your help

0

Hi Anton

I've seen your answer (to use HANA triggers) for this kind of requirement now a couple of time and always wonder how that would actually help to solve the issue.

Sure, when a new record gets inserted into a table, one can call some HANA procedure or change the data, but there is no option to signal the XS/XSA app connected to the HANA instance in this setup.

If I'm following correctly, the only way for the application to notice and react to new records in the table would be to poll the table and look for new entries. Is that correct? Or how else would that work?

Thanks for sharing your approach!

Lars

0

Hello Lars,

when suggesting Triggers those days, I have been pretty much confident that calling XSJS procedures by Triggers was a part of the hands-on session done by Thomas in one of those firsts openSAP "SAP HANA" courses [1] (late 2013). Now, after watching some of the videos, I couldn't find it. Also, this direct answer [2] from Thomas confirms that I was wrong. My fault.

So, the only way would be to poll the table, as you say. Thanks for correction!

[1] https://open.sap.com/courses/hana1-1

[2] https://archive.sap.com/discussions/thread/3767268

1

Thanks for the super swift clarification. Much appreciated.

0