Delete record on non-interactive source with an OMM off-stream post (websocket)

Hi - how do I delete a specific record using an OMM off-stream post on the ads web socket please?

I'm using a type "Update" with an Action "Delete" - I get an Ack back from the ads, but the record doesn't get deleted.

How do I remove it from cache please with a post?

Thanks

Martin

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hello @martin.gregory

    Thank you for contacting us. Based on the Real-Time WebSocket API specification document, the POST and the Market Price domain messages do not have an "Action" attribute. Which data domain you are posting and want to delete the upstream cache?

    However, you can post the status message with state and text information that the item stream is closed because the item has been deleted to replace that cache data as follows:

    mp_post_json = {
                'ID': <Stream ID based on your onstream or offstream post>,
                'Type':'Post',
                'Domain':'MarketPrice',
                'Ack':True,
                'PostID':post_id,
                'PostUserInfo': {
                    'Address':position,  # Use IP address as the Post User Address.
                    'UserID':os.getpid() # Use process ID as the Post User Id.
                },
                'Key': {
                    'Name': '<Item Name>',
                    'Service': '<Service Name>'
                },
                'Message': {
                    'ID': 0,
                    'Type':'Status',
                    'State': {
                        'Stream': 'Closed',
                        'Data': 'Suspect',
                        'Code': 'None',
                        'Text': '***Item Deleted'
                    }
                }
            }

    Example from the WebSocket Python examples (market_price.py and market_price_posting.py)

    Firstly, the market_price_posting.py posts the Update message to my local RTDS.

    SENT:
    {
      "Ack":true,
      "Domain":"MarketPrice",
      "ID":1,
      "Key":{
        "Name":"POST.ITEM",
        "Service":"DIST_CACHE"
      },
      "Message":{
        "Domain":"MarketPrice",
        "Fields":{
          "ASK":54.57,
          "ASKSIZE":28,
          "BID":54.55,
          "BIDSIZE":27
        },
        "ID":0,
        "Type":"Update"
      },
      "PostID":10,
      "PostUserInfo":{
        "Address":"192.168.68.111",
        "UserID":14492
      },
      "Type":"Post"
    }RECEIVED:
    [
      {
        "AckID":10,
        "ID":1,
        "Type":"Ack"
      }
    ]

    Next, the market_price.py gets updated for RIC POST.ITEM from my local RTDS

    RECEIVED: 
    [
      {
        "Fields":{
          "ASK":54.57,
          "ASKSIZE":28,
          "BID":54.55,
          "BIDSIZE":27
        },
        "ID":2,
        "Key":{
          "Name":"POST.ITEM",
          "Service":"DIST_CACHE"
        },
        "PostUserInfo":{
          "Address":"192.168.68.111",
          "UserID":14492
        },
        "Type":"Update",
        "UpdateType":"Unspecified"
      }
    ]

    Then, the market_price_positng.py posts Status close to my local RTDS

    SENT:
    {
      "Ack":true,
      "Domain":"MarketPrice",
      "ID":1,
      "Key":{
        "Name":"POST.ITEM",
        "Service":"DIST_CACHE"
      },
      "Message":{
        "ID":0,
        "State":{
          "Code":"None",
          "Data":"Suspect",
          "Stream":"Closed",
          "Text":"***Item Deleted"
        },
        "Type":"Status"
      },
      "PostID":11,
      "PostUserInfo":{
        "Address":"192.168.68.111",
        "UserID":14492
      },
      "Type":"Post"
    }
    RECEIVED:
    [
      {
        "AckID":11,
        "ID":1,
        "Type":"Ack"
      }
    ]

    Finally, the market_price.py get this status close message for a POST.ITEM RIC.

    RECEIVED: 
    [
      {
        "ID":2,
        "Key":{
          "Name":"POST.ITEM",
          "Service":"DIST_CACHE"
        },
        "PostUserInfo":{
          "UserID":14492
        },
        "State":{
          "Data":"Suspect",
          "Stream":"Closed",
          "Text":"****Item Deleted"
        },
        "Type":"Status"
      }
    ]

    I hope this information helps.

Answers