Class Processing

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

public final class Processing extends Object
Processing Contains methods of "processing" module of EVER-SDK API Message processing module. This module incorporates functions related to complex message processing scenarios.
  • Constructor Details

    • Processing

      public Processing()
  • Method Details

    • sendMessage

      public static Processing.ResultOfSendMessage sendMessage(Context ctx, String message, Abi.ABI abi, Boolean sendEvents) throws EverSdkException
      Sends message to the network and returns the last generated shard block of the destination account before the message was sent. It will be required later for message processing. Sends message to the network
      Parameters:
      message - Message BOC.
      abi - If this parameter is specified and the message has the `expire` header then expiration time will be checked against the current time to prevent unnecessary sending of already expired message. The `message already expired` error will be returned in this case. Note, that specifying `abi` for ABI compliant contracts is strongly recommended, so that proper processing strategy can be chosen. Optional message ABI.
      sendEvents - Flag for requesting events sending
      Throws:
      EverSdkException
    • waitForTransaction

      public static Processing.ResultOfProcessMessage waitForTransaction(Context ctx, Abi.ABI abi, String message, String shardBlockId, Boolean sendEvents, String[] sendingEndpoints) throws EverSdkException
      `send_events` enables intermediate events, such as `WillFetchNextBlock`, `FetchNextBlockFailed` that may be useful for logging of new shard blocks creation during message processing. Note, that presence of the `abi` parameter is critical for ABI compliant contracts. Message processing uses drastically different strategy for processing message for contracts which ABI 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` parameter isn'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. Performs monitoring of the network for the result transaction of the external inbound message processing.
      Parameters:
      abi - If it is specified, then the output messages' bodies will be decoded according to this ABI. The `abi_decoded` result field will be filled out. Optional ABI for decoding the transaction result.
      message - Encoded with `base64`. Message BOC.
      shardBlockId - You must provide the same value as the `send_message` has returned. The last generated block id of the destination account shard before the message was sent.
      sendEvents - Flag that enables/disables intermediate events
      sendingEndpoints - 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. The list of endpoints to which the message was sent.
      Throws:
      EverSdkException
    • processMessage

      public static Processing.ResultOfProcessMessage processMessage(Context ctx, Abi.ABI abi, String address, Abi.DeploySet deploySet, Abi.CallSet callSet, Abi.Signer signer, Integer processingTryIndex, Integer signatureId, Boolean sendEvents) throws EverSdkException
      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, then SDK implements retries in case of unsuccessful message delivery within the expiration timeout: 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` flag and 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" header then, if no transaction is found within the network timeout (see config parameter ), exits with error. Creates message, sends it to the network and monitors its processing.
      Parameters:
      abi - Contract ABI.
      address - Must be specified in case of non-deploy message. Target address the message will be sent to.
      deploySet - Must be specified in case of deploy message. Deploy parameters.
      callSet - Must be specified in case of non-deploy message. In case of deploy message it is optional and contains parameters of the functions that will to be called upon deploy transaction. Function call parameters.
      signer - Signing parameters.
      processingTryIndex - Used in message processing with retries (if contract's ABI includes "expire" header). Encoder uses the provided try index to calculate message expiration time. The 1st message expiration time is specified in Client config. Expiration timeouts will grow with every retry. Retry grow factor is set in Client config: invalid input: '<'.....add config parameter with default value here> Default value is 0. Processing try index.
      signatureId - Signature ID to be used in data to sign preparing when CapSignatureWithId capability is enabled
      sendEvents - Flag for requesting events sending
      Throws:
      EverSdkException