Class Processing

java.lang.Object
tech.deplant.java4ever.binding.Processing

public class Processing extends Object
processing Contains methods of "processing" module. Message processing module. This module incorporates functions related to complex messageprocessing scenarios.
  • Constructor Details

    • Processing

      public Processing()
  • Method Details

    • sendMessage

      public static Processing.ResultOfSendMessage sendMessage(Context ctx, String message, Abi.ABI abi, Boolean sendEvents, Consumer<SendMessageEvent> consumer) throws EverSdkException
      processing.send_message Sends message to the network Sends message to the network and returns the last generated shard block of the destination accountbefore the message was sent. It will be required later for message processing.
      Parameters:
      message - Message BOC.
      abi - Optional message ABI. If this parameter is specified and the message has the`expire` header then expiration time will be checked againstthe current time to prevent unnecessary sending of already expired message.

      The `message already expired` error will be returned in thiscase.

      Note, that specifying `abi` for ABI compliant contracts isstrongly recommended, so that proper processing strategy can bechosen.

      sendEvents - Flag for requesting events sending
      Returns:
      Processing.ResultOfSendMessage
      Throws:
      EverSdkException
    • waitForTransaction

      public static Processing.ResultOfProcessMessage waitForTransaction(Context ctx, Abi.ABI abi, String message, String shardBlockId, Boolean sendEvents, String[] sendingEndpoints, Consumer<WaitForTransactionEvent> consumer) throws EverSdkException
      processing.wait_for_transaction Performs monitoring of the network for the result transaction of the external inbound message processing. `send_events` enables intermediate events, such as `WillFetchNextBlock`,`FetchNextBlockFailed` that may be useful for logging of new shard blocks creationduring message processing.

      Note, that presence of the `abi` parameter is critical for ABIcompliant contracts. Message processing uses drasticallydifferent strategy for processing message for contracts whichABI includes "expire" header.

      When the ABI header `expire` is present, the processing uses`message expiration` strategy:- The maximum block gen time is set to `message_expiration_timeout + transaction_wait_timeout`.- When maximum block gen time is reached, the processing will be finished with `MessageExpired` error.

      When the ABI header `expire` isn't present or `abi` parameterisn't specified, the processing uses `transaction waiting`strategy:- The maximum block gen time is set to `now() + transaction_wait_timeout`.

      - If maximum block gen time is reached and no result transaction is found,the processing will exit with an error.

      Parameters:
      abi - Optional ABI for decoding the transaction result. If it is specified, then the output messages' bodies will bedecoded according to this ABI.

      The `abi_decoded` result field will be filled out.

      message - Message BOC. Encoded with `base64`.
      shardBlockId - The last generated block id of the destination account shard before the message was sent. You must provide the same value as the `send_message` has returned.
      sendEvents - Flag that enables/disables intermediate events
      sendingEndpoints - The list of endpoints to which the message was sent. Use this field to get more informative errors.Provide the same value as the `send_message` has returned.If the message was not delivered (expired), SDK will log the endpoint URLs, used for its sending.
      Returns:
      Processing.ResultOfProcessMessage
      Throws:
      EverSdkException
    • processMessage

      public static Processing.ResultOfProcessMessage processMessage(Context ctx, Abi.ABI abi, String address, Abi.DeploySet deploySet, Abi.CallSet callSet, Abi.Signer signer, Number processingTryIndex, Boolean sendEvents, Consumer<ProcessMessageEvent> consumer) throws EverSdkException
      processing.process_message Creates message, sends it to the network and monitors its processing. Creates ABI-compatible message,sends it to the network and monitors for the result transaction.Decodes the output messages' bodies.

      If contract's ABI includes "expire" header, thenSDK implements retries in case of unsuccessful message delivery within the expirationtimeout: SDK recreates the message, sends it and processes it again.

      The intermediate events, such as `WillFetchFirstBlock`, `WillSend`, `DidSend`,`WillFetchNextBlock`, etc - are switched on/off by `send_events` flagand logged into the supplied callback function.

      The retry configuration parameters are defined in the client's `NetworkConfig` and `AbiConfig`.

      If contract's ABI does not include "expire" headerthen, if no transaction is found within the network timeout (see config parameter ), exits with error.

      Parameters:
      abi - Contract ABI.
      address - Target address the message will be sent to. Must be specified in case of non-deploy message.
      deploySet - Deploy parameters. Must be specified in case of deploy message.
      callSet - Function call parameters. Must be specified in case of non-deploy message.

      In case of deploy message it is optional and contains parametersof the functions that will to be called upon deploy transaction.

      signer - Signing parameters.
      processingTryIndex - Processing try index. Used in message processing with retries (if contract's ABI includes "expire" header).

      Encoder uses the provided try index to calculate messageexpiration time. The 1st message expiration time is specified inClient config.

      Expiration timeouts will grow with every retry.Retry grow factor is set in Client config:<.....add config parameter with default value here>

      Default value is 0.

      sendEvents - Flag for requesting events sending
      Returns:
      Processing.ResultOfProcessMessage
      Throws:
      EverSdkException