Skip to content

Commit 04308e3

Browse files
committed
rename to main.go
1 parent d09842d commit 04308e3

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

.goreleaser.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
project_name: zeebe-http-extension
2+
release:
3+
github:
4+
owner: zeebe-io
5+
name: zeebe-http-extension
6+
draft: false
7+
builds:
8+
-
9+
goos:
10+
- linux
11+
- darwin
12+
- windows
13+
goarch:
14+
- amd64
15+
- 386
16+
ignore:
17+
- goos: darwin
18+
goarch: 386
19+
main: ./main.go
20+
binary: zeebe-http
21+
archive:
22+
format: tar.gz
23+
name_template: 'zeebe-http-{{ .Version }}-{{ .Os }}_{{ .Arch }}'
24+
replacements:
25+
darwin: Darwin
26+
linux: Linux
27+
windows: Windows
28+
amd64: x86_64
29+
386: i386
30+
format_overrides:
31+
- goos: windows
32+
format: zip
33+
snapshot:
34+
name_template: SNAPSHOT-{{ .Commit }}
35+
checksum:
36+
name_template: 'zeebe-http-{{ .Version }}_checksums.txt'

worker.go renamed to main.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ func handleJob(client zbsubscribe.ZeebeAPI, event *zbsubscriptions.SubscriptionE
5959

6060
url := getParameter(job, "url")
6161
if url == nil {
62-
// TODO handle error
6362
fmt.Println("Missing required parameter 'URL'")
63+
job.Retries--
64+
client.FailJob(event)
6465
return
6566
}
6667

@@ -74,17 +75,19 @@ func handleJob(client zbsubscribe.ZeebeAPI, event *zbsubscriptions.SubscriptionE
7475
if body != nil {
7576
jsonDocument, err := json.Marshal(body)
7677
if err != nil {
77-
// TODO handle error
7878
fmt.Println(err)
79+
job.Retries--
80+
client.FailJob(event)
7981
return
8082
}
8183
reqBody = bytes.NewReader(jsonDocument)
8284
}
8385

8486
statusCode, resBody, err := request(url.(string), method.(string), reqBody)
8587
if err != nil {
86-
// TODO handle error
8788
fmt.Println(err)
89+
job.Retries--
90+
client.FailJob(event)
8891
return
8992
}
9093

@@ -102,10 +105,8 @@ func getParameter(job *zbmsgpack.Job, param string) interface{} {
102105
return value
103106
}
104107

105-
p, _ := job.GetPayload()
106-
payload := *p
107-
108-
value = payload[param]
108+
payload, _ := job.GetPayload()
109+
value = (*payload)[param]
109110
return value
110111
}
111112

0 commit comments

Comments
 (0)