laravolt / camunda

Convenience Laravel HTTP client wrapper to interact with Camunda REST API.
https://laravolt.dev
16 stars 11 forks source link

Add error handling for completing external task #14

Closed ramaID closed 1 year ago

uyab commented 1 year ago

Ini kenapa harus nge-throw? Sesimpel error nya di log gitu ga cukup?

ramaID commented 1 year ago

Screenshot 2023-06-13 at 13 46 05

mungkin bisa, Pak. tapi, apakah dia akan masuk ke log-nya aplikasi? ini contoh implementasi ku, dengan di report harusnya dia juga akan masuk ke sentry untuk debugging lebih lanjut. tanpa membuka laravel.log dan nyari tau satu per satu

ramaID commented 1 year ago
Screenshot 2023-06-13 at 13 53 18

lebih lanjut, kita akan lebih mudah debugging di Laravel Horizon seperti ini, Pak @uyab

implementasi kode-nya cukup seperti ini:

    public function handle()
    {
        ProcessInstanceClient::variables($this->task->processInstanceId);
        $aduan = Pengaduan::query()->where('process_instance_id', $this->task->processInstanceId)->firstOrFail();
        // TODO: code here

        ExternalTaskClient::complete(
            $this->task->id,
            $this->workerId,
            ['isCategoryAppropriate' => [
                'type' => 'Booleana',
                'value' => true,
            ]],
        );
    }
ramaID commented 1 year ago
Screenshot 2023-06-13 at 14 15 59

better with context di Laravel Horizon

ramaID commented 1 year ago
Screenshot 2023-06-13 at 14 18 02

retrying setelah perbaikan