Discuss this help topic in MsgConnect Forum

Filter: C++  Pascal  C#  VB.NET  Java  Java ME  ActiveX  DLL 



Messenger.SendMessageTimeoutCallback

Messenger     See also    


Sends a message to the recipient, request reply and return immediately.

Declaration

[C++]
    void SendMessageTimeoutCallback(const char* Destination, MCMessage* Message, DWORD Timeout, MCNotifyProc CompletionProc, MCNotifyProc TimeoutProc, MCErrorProc ErrorProc, DWORD UserData, MCMessageCredentials* Credentials);

[Pascal]
    procedure SendMessageTimeoutCallback(Destination: string; var Message: TMCMessage; Timeout: DWORD; CompletionProc: TMCNotifyProc; TimeoutProc: TMCNotifyProc; ErrorProc: TMCErrorProc; UserData: DWORD; Credentials: PMCMessageCredentials);

[VB6]
    Sub IMCXMessenger2.SendMessageTimeoutCallback(Destination As String, Message As IMCXMessage, Timeout As Long, Credentials As MCXMessageCredentials)

[ActiveX]
    HRESULT _stdcall IMCXMessenger2.SendMessageTimeoutCallback([in] BSTR Destination, [in] IMCXMessage Message, [in] unsigned long Timeout, [in] IMCXMessageCredentials Credentials );
NotifyProc parameter is not available. Callback is implemented as OnCompletion event in MCXMessenger object.
TimeoutProc parameter is not available. Callback is implemented as OnTimeout event in MCXMessenger object.
ErrorProc parameter is not available. Callback is implemented as OnError event in MCXMessenger object.

[C#]
    public void SendMessageTimeoutCallback(string Destination, MCMessage Message, int Timeout, MCNotifyProc CompletionProc, MCNotifyProc TimeoutProc, MCErrorProc ErrorProc, object UserData, MCMessageCredentials Credentials);

[VB.NET]
    Public Sub SendMessageTimeoutCallback(ByVal Destination As String, ByVal Message As MCMessage, ByVal Timeout As Integer, ByVal CompletionProc As MCNotifyProc, ByVal TimeoutProc As MCNotifyProc, ByVal ErrorProc As MCErrorProc, ByVal UserData As Object, ByVal Credentials As MCMessageCredentials)

[Java]
     public synchronized void sendMessageTimeoutCallback(String destination, MCMessage message, Object timeout, MCNotifyProc completionProc, MCTimeoutProc timeoutProc, MCErrorProc errorProc, long userData, MCMessageCredentials credentials);

[Java ME]
    public synchronized void sendMessageTimeoutCallback(String destination, MCMessage message, Object timeout, MCNotifyProc completionProc, MCTimeoutProc timeoutProc, MCErrorProc errorProc, long userData, MCMessageCredentials credentials);

[DLL]
    long __stdcall MCMessengerSendMessageTimeoutCallback(HMCMessenger h, const char* Destination, MCMessage* Message, unsigned long Timeout, MCNotifyProc CompletionProc, MCNotifyProc TimeoutProc, MCErrorProc ErrorProc, unsigned long UserData, MCMessageCredentials* Credentials);

Parameters

  • Destination - The address of the message recipient. See more here
  • Message - The message to be sent. See more here
  • Timeout - Time (in milliseconds) after which the method marks the message as failed and returns. Setting this parameter to 0xFFFFFFFF ($FFFFFFFF) causes the method to wait infinitely for reply (in fact, waiting is stopped after time specified by MaxTimeout property elapses)
  • CompletionProc - The function that will be called when the reply is received.
  • TimeoutProc - Deletes expired messages from queue.
  • ErrorProc - The function that will be called when the message is returned as failed.
  • UserData - Application-defined parameter that will be passed as a first parameter of the NotifyProc function. This lets you set NotifyProc to a reference to class memeber, and pass an instance reference in UserData parameter.
  • Credentials - (optional) Credentials to be set for the message. Can be set to null (nil) if credentials system is not used. See more here
  • [DLL]h - handle to the Messenger object that was returned by Create method

Description

    Call this method to send the message to some other messenger and be notifed when the result arrives or the message is returned as failed. At the same time you can use this method when you want wait for reply from the recipient for specified time, optionally dispatching incoming messages. Destination specifies the address of the recipient. This method determines the right transport to use and passes the message to the transport. If the transport was not found or the request didn't reach the recipient for some reason, an exception is raised. [DLL] Error is determined by return value.
    Result of the message is passed together with message data to the callback function defined by NotifyProc. For information about error and timeout handling see Error and Timeout Handling topic.

    Note, that OnTimeout is not called exactly after the period specified in Timeout parameter. Once per certain time interval, specified in CleanupInterval, DispatchMessages method (you need to call it) scans all outgoing messages and searches for expired ones. If they are found, OnTimeout is called.

Discuss this help topic in MsgConnect Forum