Skip to content

Commit

Permalink
rename to main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
saig0 committed Jun 12, 2018
1 parent d09842d commit 04308e3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
project_name: zeebe-http-extension
release:
github:
owner: zeebe-io
name: zeebe-http-extension
draft: false
builds:
-
goos:
- linux
- darwin
- windows
goarch:
- amd64
- 386
ignore:
- goos: darwin
goarch: 386
main: ./main.go
binary: zeebe-http
archive:
format: tar.gz
name_template: 'zeebe-http-{{ .Version }}-{{ .Os }}_{{ .Arch }}'
replacements:
darwin: Darwin
linux: Linux
windows: Windows
amd64: x86_64
386: i386
format_overrides:
- goos: windows
format: zip
snapshot:
name_template: SNAPSHOT-{{ .Commit }}
checksum:
name_template: 'zeebe-http-{{ .Version }}_checksums.txt'
15 changes: 8 additions & 7 deletions worker.go → main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ func handleJob(client zbsubscribe.ZeebeAPI, event *zbsubscriptions.SubscriptionE

url := getParameter(job, "url")
if url == nil {
// TODO handle error
fmt.Println("Missing required parameter 'URL'")
job.Retries--
client.FailJob(event)
return
}

Expand All @@ -74,17 +75,19 @@ func handleJob(client zbsubscribe.ZeebeAPI, event *zbsubscriptions.SubscriptionE
if body != nil {
jsonDocument, err := json.Marshal(body)
if err != nil {
// TODO handle error
fmt.Println(err)
job.Retries--
client.FailJob(event)
return
}
reqBody = bytes.NewReader(jsonDocument)
}

statusCode, resBody, err := request(url.(string), method.(string), reqBody)
if err != nil {
// TODO handle error
fmt.Println(err)
job.Retries--
client.FailJob(event)
return
}

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

p, _ := job.GetPayload()
payload := *p

value = payload[param]
payload, _ := job.GetPayload()
value = (*payload)[param]
return value
}

Expand Down

0 comments on commit 04308e3

Please sign in to comment.