REDI API cancel order by OrderRefKey

newuser
newuser Contributor

I have the following code but it throws type mismatch.

object err = null;
rediCache.Submit("Message", "Status==0 || Status==1 || Status==2 || Status==3", ref err);
rediCache.CancelByKey(redi_user_id, "gS01568314", ref err);

System.Runtime.InteropServices.COMException: 'Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))'

Could you also explain whether .submt() is necessary and what those status denotes?

Additionally, is there anything I must do when stopping application? Sometimes I noticed REDI hangs after I abruptly terminate redi api application.

Thank you!

Tagged:

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @39783854-26aa-4fea-bc93-00b2ec21f8bb_deprecated_3a75f99c-5134-4b2b-ba84-37662f80bc56

    I got the same exception if CancelByKey is called immediately after Submit. It works fine if I call CancelByKey in the CacheEvent handler.

    However, from my test, the CancelByKey can be called without Submit.

    object err = null;

    rediCache.CancelByKey(redi_user_id, "gS01568314", ref err);

    The meanings of status codes and where options are mentioned in Appendix A REDI Data Fields in the REDI API SPECIFICATION.

     '======= REDI ORDER STATUS TABLE (status) =============
    ' 0: Open 1: Partial 2: Complete 3: Canceled 4: Reject
    ' 5: Deleted 6: Failed 7: Pending Reroute 8: Pending
    '======================================================

    For the hang issue, we need more information. Could you please share the application and steps to replicate the problem?

Answers

  • newuser
    newuser Contributor

    it worked with just submit as you had stated.

    I got the example from REDI API pdf

    1.10 Order Cancellation

    Cancelling an Order By ‘OrderRefKey
    Public WithEvents OrderQuery As CacheControl

    Sub CancelOrder() Set OrderQuery = New CacheControl
    Dim verr, table, where
    table = “Message”
    where = “Status==0 || Status==1 || Status==2 || Status==3”
    OrderQuery.Submit table, where, verr
    ‘ Cancel Order
    OrderQuery.CancelByKey “parkmm”, “YSJ1069332”, verr End Sub
  • newuser
    newuser Contributor

    it worked with just submit as you had stated.

    I got the example from REDI API pdf

    1.10 Order Cancellation

    Cancelling an Order By ‘OrderRefKey
    Public WithEvents OrderQuery As CacheControl

    Sub CancelOrder() Set OrderQuery = New CacheControl
    Dim verr, table, where
    table = “Message”
    where = “Status==0 || Status==1 || Status==2 || Status==3”
    OrderQuery.Submit table, where, verr
    ‘ Cancel Order
    OrderQuery.CancelByKey “parkmm”, “YSJ1069332”, verr End Sub
  • newuser
    newuser Contributor

    it worked with just submit as you had stated.

    I got the example from REDI API pdf

    1.10 Order Cancellation

    Cancelling an Order By ‘OrderRefKey
    Public WithEvents OrderQuery As CacheControl

    Sub CancelOrder() Set OrderQuery = New CacheControl
    Dim verr, table, where
    table = “Message”
    where = “Status==0 || Status==1 || Status==2 || Status==3”
    OrderQuery.Submit table, where, verr
    ‘ Cancel Order
    OrderQuery.CancelByKey “parkmm”, “YSJ1069332”, verr End Sub
  • newuser
    newuser Contributor