forked from AlfrescoArchive/activiti-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
638 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,13 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
/target | ||
/local | ||
|
||
# Eclipse, Netbeans and IntelliJ files | ||
/.* | ||
!.gitignore | ||
/nbproject | ||
/*.ipr | ||
/*.iws | ||
/*.iml | ||
|
||
# Repository wide ignore mac DS_Store files | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/target | ||
/local | ||
|
||
# Eclipse, Netbeans and IntelliJ files | ||
/.* | ||
!.gitignore | ||
/nbproject | ||
/*.ipr | ||
/*.iws | ||
/*.iml | ||
|
||
# Repository wide ignore mac DS_Store files | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.activiti</groupId> | ||
<artifactId>activiti-examples-root</artifactId> | ||
<version>7.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>activiti-microservice-client</artifactId> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-stream</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-hateoas</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-stream-rabbit</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-autoconfigure</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-messaging</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
16 changes: 16 additions & 0 deletions
16
...i-microservice-client/src/main/java/org/activiti/example/microservice/client/Command.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.activiti.example.microservice.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.PROPERTY, | ||
property = "commandType") | ||
public interface Command { | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...ervice-client/src/main/java/org/activiti/example/microservice/client/CommandChannels.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.activiti.example.microservice.client; | ||
|
||
import org.springframework.cloud.stream.annotation.Input; | ||
import org.springframework.cloud.stream.annotation.Output; | ||
import org.springframework.messaging.MessageChannel; | ||
import org.springframework.messaging.SubscribableChannel; | ||
|
||
public interface CommandChannels { | ||
|
||
String CMD_OUTPUT = "cmdOutput"; | ||
|
||
String CMD_RESULTS = "cmdResults"; | ||
|
||
@Output(CMD_OUTPUT) | ||
MessageChannel cmdOutput(); | ||
|
||
@Input(CMD_RESULTS) | ||
SubscribableChannel cmdResults(); | ||
} |
44 changes: 44 additions & 0 deletions
44
...rc/main/java/org/activiti/example/microservice/client/MicroServiceExampleApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.activiti.example.microservice.client; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.stream.annotation.EnableBinding; | ||
import org.springframework.hateoas.MediaTypes; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.messaging.MessageChannel; | ||
import org.springframework.messaging.support.MessageBuilder; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@SpringBootApplication | ||
@EnableBinding(CommandChannels.class) | ||
@RestController | ||
@RequestMapping(value = "/api/", produces = MediaTypes.HAL_JSON_VALUE) | ||
public class MicroServiceExampleApplication { | ||
|
||
@Autowired | ||
private MessageChannel cmdOutput; | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(MicroServiceExampleApplication.class, | ||
args); | ||
} | ||
|
||
@RequestMapping(method = RequestMethod.POST, path = "/send") | ||
public ResponseEntity sendMessage() { | ||
Map<String, String> vars = new HashMap<>(); | ||
vars.put("hey", "one"); | ||
StartProcessCmd cmd = new StartProcessCmd("myId", vars); | ||
cmdOutput.send((MessageBuilder.withPayload(cmd).build())); | ||
return new ResponseEntity<String>(cmd + " ack!", | ||
HttpStatus.OK); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ervice-client/src/main/java/org/activiti/example/microservice/client/StartProcessCmd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.activiti.example.microservice.client; | ||
|
||
import java.util.Map; | ||
|
||
|
||
public class StartProcessCmd implements Command { | ||
|
||
private String processDefinitionKey; | ||
private Map<String, String> variables; | ||
|
||
public StartProcessCmd() { | ||
} | ||
|
||
public StartProcessCmd(String processDefinitionKey, | ||
Map<String, String> variables) { | ||
this.processDefinitionKey = processDefinitionKey; | ||
this.variables = variables; | ||
} | ||
|
||
public String getProcessDefinitionKey() { | ||
return processDefinitionKey; | ||
} | ||
|
||
public Map<String, String> getVariables() { | ||
return variables; | ||
} | ||
|
||
|
||
} |
3 changes: 3 additions & 0 deletions
3
activiti-microservice-client/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
spring.cloud.stream.bindings.cmdOutput.destination=commandConsumer | ||
spring.cloud.stream.bindings.cmdOutput.contentType=application/json | ||
server.port=8081 |
Oops, something went wrong.