├── .gitignore
├── LICENSE
├── annotations
├── pom.xml
└── src
│ └── main
│ └── java
│ └── org
│ └── flowable
│ └── experimental
│ └── bpmn
│ ├── Bpmn.java
│ └── BpmnModels.java
├── flowable-serverless
├── pom.xml
└── src
│ └── main
│ └── java
│ └── org
│ └── flowable
│ └── serverless
│ ├── NoDbDbSqlSessionFactory.java
│ ├── NoDbProcessDefinitionEntityManager.java
│ ├── NoDbProcessEngineConfiguration.java
│ ├── ServerlessUtil.java
│ └── Util.java
├── micronaut-sample-process
├── .gitignore
├── .mvn
│ ├── jvm.config
│ └── wrapper
│ │ ├── MavenWrapperDownloader.java
│ │ ├── maven-wrapper.jar
│ │ └── maven-wrapper.properties
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── org.flowable
│ │ └── app
│ │ ├── StartToEndProcess.java
│ │ └── TestProcess.java
│ └── resources
│ └── processes
│ ├── start-to-end.bpmn20.xml
│ └── test-process.bpmn20.xml
├── micronaut-sample
├── .gitignore
├── .mvn
│ ├── jvm.config
│ └── wrapper
│ │ ├── MavenWrapperDownloader.java
│ │ ├── maven-wrapper.jar
│ │ └── maven-wrapper.properties
├── Dockerfile
├── DockerfileAllInOne
├── build-native-image.sh
├── dependency-reduced-pom.xml
├── docker-build.sh
├── micronaut-cli.yml
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── org.flowable
│ │ └── app
│ │ ├── Application.java
│ │ ├── MicronautSubstitutions.java
│ │ └── ProcessController.java
│ └── resources
│ ├── application.yml
│ ├── custom-reflect.json
│ └── logback.xml
├── pom.xml
├── processor
├── pom.xml
└── src
│ └── main
│ ├── java
│ ├── org
│ │ └── flowable
│ │ │ └── experimental
│ │ │ └── processor
│ │ │ └── bpmn
│ │ │ ├── BpmnModelCreator.java
│ │ │ ├── BpmnModelProcessor.java
│ │ │ └── BpmnPropertyHolder.java
│ └── temp
│ │ ├── CustomHttpActivityBehavior.java
│ │ └── TempServiceTaskExpressionActivityBehavior.java
│ └── resources
│ └── META-INF
│ └── services
│ └── javax.annotation.processing.Processor
├── sample
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ ├── experiment
│ │ │ ├── MyJavaDelegate.java
│ │ │ └── StartProcessFunction.java
│ │ └── org
│ │ │ └── flowable
│ │ │ └── sample
│ │ │ ├── AsyncProcesses.java
│ │ │ ├── ExampleProcesses.java
│ │ │ ├── SimpleServiceTaskProcess.java
│ │ │ └── StartToEndProcess.java
│ └── resources
│ │ ├── log4j.properties
│ │ └── processes
│ │ ├── my-process.bpmn20.xml
│ │ ├── proc-two-async-tasks.bpmn
│ │ ├── simple-service-task.bpmn20.xml
│ │ ├── start-to-end.bpmn20.xml
│ │ └── vacationRequest.bpmn20.xml
│ └── test
│ └── java
│ └── org
│ └── flowable
│ └── sample
│ ├── MyProcessTest.java
│ ├── ProcTwoAsyncTasksTest.java
│ └── VacationRequestTest.java
├── spring-boot-sample
├── pom.xml
└── src
│ └── main
│ ├── java
│ ├── experiment
│ │ └── MyJavaDelegate.java
│ └── org
│ │ └── flowable
│ │ └── sample
│ │ ├── DemoApplication.java
│ │ └── SimpleServiceTaskProcess.java
│ └── resources
│ ├── application.properties
│ ├── log4j.properties
│ └── processes
│ └── simple-service-task.bpmn20.xml
├── spring-cloud-aws-sample
├── pom.xml
└── src
│ └── main
│ ├── java
│ ├── experiment
│ │ └── MyJavaDelegate.java
│ └── org
│ │ └── flowable
│ │ └── sample
│ │ ├── DemoApplication.java
│ │ ├── FunctionInput.java
│ │ ├── SimpleServiceTaskProcess.java
│ │ └── StartProcessRequestHandler.java
│ └── resources
│ ├── application.properties
│ ├── log4j.properties
│ └── processes
│ └── simple-service-task.bpmn20.xml
└── spring-fu-sample
├── build-graal-image.sh
├── graal
├── app.json
├── boot.json
├── custom-reflect.json
├── framework.json
├── log4j.json
└── netty.json
├── pom.xml
└── src
└── main
├── java
├── experiment
│ └── MyJavaDelegate.java
└── org
│ └── flowable
│ └── sample
│ ├── ProcessHandler.java
│ ├── ProcessService.java
│ ├── SimpleServiceTaskProcess.java
│ └── SpringFuApplication.java
└── resources
├── application.properties
├── log4j.properties
└── processes
└── simple-service-task.bpmn20.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | *.iml
3 | *.ipr
4 | *.iws
5 | .idea/
6 | .classpath
7 | .project
8 | .settings
9 | .DS_Store
10 | .vscode
11 | flowable-micronaut-app
12 | libsunec.dylib
13 |
--------------------------------------------------------------------------------
/annotations/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.flowable.experimental
8 | flowable-serverless-parent
9 | 6.4.0-SNAPSHOT
10 |
11 |
12 | flowable-processor-annotations
13 |
14 |
15 |
--------------------------------------------------------------------------------
/annotations/src/main/java/org/flowable/experimental/bpmn/Bpmn.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.experimental.bpmn;
14 |
15 | import java.lang.annotation.ElementType;
16 | import java.lang.annotation.Repeatable;
17 | import java.lang.annotation.Retention;
18 | import java.lang.annotation.RetentionPolicy;
19 | import java.lang.annotation.Target;
20 |
21 | /**
22 | * @author Filip Hrisafov
23 | */
24 | @Repeatable(BpmnModels.class)
25 | @Retention(RetentionPolicy.CLASS)
26 | @Target(ElementType.TYPE)
27 | public @interface Bpmn {
28 |
29 | String resource();
30 |
31 | boolean enableEagerExecutionTreeFetching() default true;
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/annotations/src/main/java/org/flowable/experimental/bpmn/BpmnModels.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.experimental.bpmn;
14 |
15 | import java.lang.annotation.ElementType;
16 | import java.lang.annotation.Retention;
17 | import java.lang.annotation.RetentionPolicy;
18 | import java.lang.annotation.Target;
19 |
20 | /**
21 | * @author Filip Hrisafov
22 | */
23 | @Retention(RetentionPolicy.CLASS)
24 | @Target(ElementType.TYPE)
25 | public @interface BpmnModels {
26 |
27 | Bpmn[] value();
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/flowable-serverless/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.flowable.experimental
8 | flowable-serverless-parent
9 | 6.4.0-SNAPSHOT
10 |
11 |
12 | flowable-serverless
13 |
14 |
15 |
16 |
17 | org.flowable
18 | flowable-engine
19 |
20 |
21 |
22 | org.junit.jupiter
23 | junit-jupiter-engine
24 | test
25 |
26 |
27 |
28 | org.xmlunit
29 | xmlunit-assertj
30 | test
31 |
32 |
33 |
34 | org.slf4j
35 | slf4j-log4j12
36 | 1.7.5
37 | test
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/flowable-serverless/src/main/java/org/flowable/serverless/NoDbDbSqlSessionFactory.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.serverless;
14 |
15 | import java.sql.Connection;
16 |
17 | import org.apache.ibatis.session.Configuration;
18 | import org.apache.ibatis.session.ExecutorType;
19 | import org.apache.ibatis.session.SqlSession;
20 | import org.apache.ibatis.session.SqlSessionFactory;
21 | import org.apache.ibatis.session.TransactionIsolationLevel;
22 | import org.flowable.common.engine.impl.context.Context;
23 | import org.flowable.common.engine.impl.db.DbSqlSession;
24 | import org.flowable.common.engine.impl.db.DbSqlSessionFactory;
25 | import org.flowable.common.engine.impl.interceptor.CommandContext;
26 | import org.flowable.common.engine.impl.interceptor.Session;
27 | import org.flowable.common.engine.impl.persistence.cache.EntityCache;
28 |
29 | public class NoDbDbSqlSessionFactory extends DbSqlSessionFactory {
30 |
31 | public NoDbDbSqlSessionFactory(boolean usePrefixId) {
32 | super(usePrefixId);
33 | }
34 |
35 | @Override
36 | public Session openSession(CommandContext commandContext) {
37 | return new NoDbDbSqlSession(this, Context.getCommandContext().getSession(EntityCache.class));
38 | }
39 |
40 | @Override
41 | public SqlSessionFactory getSqlSessionFactory() {
42 | return new SqlSessionFactory() {
43 |
44 | @Override
45 | public SqlSession openSession() {
46 | return null;
47 | }
48 | @Override
49 | public SqlSession openSession(boolean b) {
50 | return null;
51 | }
52 | @Override
53 | public SqlSession openSession(Connection connection) {
54 | return null;
55 | }
56 | @Override
57 | public SqlSession openSession(TransactionIsolationLevel transactionIsolationLevel) {
58 | return null;
59 | }
60 | @Override
61 | public SqlSession openSession(ExecutorType executorType) {
62 | return null;
63 | }
64 | @Override
65 | public SqlSession openSession(ExecutorType executorType, boolean b) {
66 | return null;
67 | }
68 | @Override
69 | public SqlSession openSession(ExecutorType executorType, TransactionIsolationLevel transactionIsolationLevel) {
70 | return null;
71 | }
72 | @Override
73 | public SqlSession openSession(ExecutorType executorType, Connection connection) {
74 | return null;
75 | }
76 | @Override
77 | public Configuration getConfiguration() {
78 | return null;
79 | }
80 | };
81 | }
82 |
83 | public static class NoDbDbSqlSession extends DbSqlSession {
84 |
85 | public NoDbDbSqlSession(DbSqlSessionFactory dbSqlSessionFactory, EntityCache entityCache) {
86 | super(dbSqlSessionFactory, entityCache);
87 | }
88 |
89 | @Override
90 | public void close() {
91 |
92 | }
93 |
94 | @Override
95 | public void commit() {
96 |
97 | }
98 |
99 | @Override
100 | public void rollback() {
101 |
102 | }
103 |
104 | @Override
105 | public void flush() {
106 |
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/flowable-serverless/src/main/java/org/flowable/serverless/NoDbProcessDefinitionEntityManager.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.serverless;
14 |
15 | import java.util.List;
16 | import java.util.Map;
17 |
18 | import org.flowable.engine.impl.ProcessDefinitionQueryImpl;
19 | import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
20 | import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityManager;
21 | import org.flowable.engine.repository.ProcessDefinition;
22 |
23 | public class NoDbProcessDefinitionEntityManager implements ProcessDefinitionEntityManager {
24 |
25 | @Override
26 | public ProcessDefinitionEntity findLatestProcessDefinitionByKey(String processDefinitionKey) {
27 | throw new UnsupportedOperationException();
28 | }
29 | @Override
30 | public ProcessDefinitionEntity findLatestProcessDefinitionByKeyAndTenantId(String processDefinitionKey, String tenantId) {
31 | throw new UnsupportedOperationException();
32 | }
33 | @Override
34 | public ProcessDefinitionEntity findLatestDerivedProcessDefinitionByKey(String processDefinitionKey) {
35 | throw new UnsupportedOperationException();
36 | }
37 | @Override
38 | public ProcessDefinitionEntity findLatestDerivedProcessDefinitionByKeyAndTenantId(String processDefinitionKey, String tenantId) {
39 | throw new UnsupportedOperationException();
40 | }
41 | @Override
42 | public List findProcessDefinitionsByQueryCriteria(ProcessDefinitionQueryImpl processDefinitionQuery) {
43 | throw new UnsupportedOperationException();
44 | }
45 | @Override
46 | public long findProcessDefinitionCountByQueryCriteria(ProcessDefinitionQueryImpl processDefinitionQuery) {
47 | throw new UnsupportedOperationException();
48 | }
49 | @Override
50 | public ProcessDefinitionEntity findProcessDefinitionByDeploymentAndKey(String deploymentId, String processDefinitionKey) {
51 | throw new UnsupportedOperationException();
52 | }
53 | @Override
54 | public ProcessDefinitionEntity findProcessDefinitionByDeploymentAndKeyAndTenantId(String deploymentId, String processDefinitionKey, String tenantId) {
55 | throw new UnsupportedOperationException();
56 | }
57 | @Override
58 | public ProcessDefinition findProcessDefinitionByKeyAndVersionAndTenantId(String processDefinitionKey, Integer processDefinitionVersion,
59 | String tenantId) {
60 | throw new UnsupportedOperationException();
61 | }
62 | @Override
63 | public List findProcessDefinitionsByNativeQuery(Map parameterMap) {
64 | throw new UnsupportedOperationException();
65 | }
66 | @Override
67 | public long findProcessDefinitionCountByNativeQuery(Map parameterMap) {
68 | throw new UnsupportedOperationException();
69 | }
70 | @Override
71 | public void updateProcessDefinitionTenantIdForDeployment(String deploymentId, String newTenantId) {
72 | throw new UnsupportedOperationException();
73 | }
74 | @Override
75 | public void deleteProcessDefinitionsByDeploymentId(String deploymentId) {
76 | throw new UnsupportedOperationException();
77 | }
78 | @Override
79 | public ProcessDefinitionEntity create() {
80 | throw new UnsupportedOperationException();
81 | }
82 | @Override
83 | public ProcessDefinitionEntity findById(String entityId) {
84 | return (ProcessDefinitionEntity) ServerlessUtil.PROCESS_DEFINITION;
85 | }
86 | @Override
87 | public void insert(ProcessDefinitionEntity entity) {
88 | throw new UnsupportedOperationException();
89 | }
90 | @Override
91 | public void insert(ProcessDefinitionEntity entity, boolean fireCreateEvent) {
92 | throw new UnsupportedOperationException();
93 | }
94 | @Override
95 | public ProcessDefinitionEntity update(ProcessDefinitionEntity entity) {
96 | throw new UnsupportedOperationException();
97 | }
98 | @Override
99 | public ProcessDefinitionEntity update(ProcessDefinitionEntity entity, boolean fireUpdateEvent) {
100 | throw new UnsupportedOperationException();
101 | }
102 | @Override
103 | public void delete(String id) {
104 | throw new UnsupportedOperationException();
105 | }
106 | @Override
107 | public void delete(ProcessDefinitionEntity entity) {
108 | throw new UnsupportedOperationException();
109 | }
110 | @Override
111 | public void delete(ProcessDefinitionEntity entity, boolean fireDeleteEvent) {
112 | throw new UnsupportedOperationException();
113 | }
114 | }
--------------------------------------------------------------------------------
/flowable-serverless/src/main/java/org/flowable/serverless/NoDbProcessEngineConfiguration.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.serverless;
14 |
15 | import java.io.Reader;
16 | import java.util.Arrays;
17 | import java.util.Collections;
18 | import java.util.List;
19 | import java.util.Properties;
20 |
21 | import org.apache.ibatis.mapping.Environment;
22 | import org.apache.ibatis.session.Configuration;
23 | import org.flowable.common.engine.impl.history.HistoryLevel;
24 | import org.flowable.common.engine.impl.interceptor.Command;
25 | import org.flowable.common.engine.impl.interceptor.CommandContext;
26 | import org.flowable.common.engine.impl.interceptor.CommandInterceptor;
27 | import org.flowable.common.engine.impl.interceptor.Session;
28 | import org.flowable.common.engine.impl.interceptor.SessionFactory;
29 | import org.flowable.common.engine.impl.persistence.StrongUuidGenerator;
30 | import org.flowable.common.engine.impl.persistence.cache.EntityCache;
31 | import org.flowable.common.engine.impl.persistence.cache.EntityCacheImpl;
32 | import org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration;
33 |
34 | public class NoDbProcessEngineConfiguration extends StandaloneProcessEngineConfiguration {
35 |
36 | public NoDbProcessEngineConfiguration() {
37 | this.usingRelationalDatabase = false;
38 | this.disableIdmEngine = true;
39 | this.enableEventDispatcher = false;
40 | this.isDbHistoryUsed = false;
41 | this.historyLevel = HistoryLevel.NONE;
42 | this.performanceSettings.setEnableEagerExecutionTreeFetching(true);
43 | this.idGenerator = new StrongUuidGenerator();
44 |
45 | this.dbSqlSessionFactory = new NoDbDbSqlSessionFactory(false);
46 | this.customSessionFactories = Arrays.asList(this.dbSqlSessionFactory); // Needs to be set as initDbSqlSessionFactory won't be hit due to usingRelationalDatabase = false
47 |
48 | // Disabled due to GraalVM (uses reflection)
49 | this.flowableFunctionDelegates = Collections.emptyList();
50 | this.expressionEnhancers = Collections.emptyList();
51 | this.customExpressionEnhancers = Collections.emptyList();
52 | this.shortHandExpressionFunctions = Collections.emptyList();
53 | }
54 |
55 | @Override
56 | public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {
57 | return null;
58 | }
59 |
60 | @Override
61 | public void initSqlSessionFactory() {
62 | // disabled
63 | }
64 |
65 | @Override
66 | protected void postProcessEngineInitialisation() {
67 | // disable post-engine checks, as they require a persistent datastore
68 | }
69 |
70 | @Override
71 | public CommandInterceptor createTransactionInterceptor() {
72 | return null;
73 | }
74 |
75 | @Override
76 | public void initTransactionFactory() {
77 |
78 | }
79 |
80 | @Override
81 | public void initTransactionContextFactory() {
82 | // no transactions needed
83 | }
84 |
85 | @Override
86 | public List getAdditionalDefaultCommandInterceptors() {
87 | return null; // no need for bpmn override interceptor
88 | }
89 |
90 | @Override
91 | public void initEntityManagers() {
92 | super.initEntityManagers();
93 |
94 | this.processDefinitionEntityManager = new NoDbProcessDefinitionEntityManager();
95 | }
96 |
97 | @Override
98 | public boolean isUsingSchemaMgmt() {
99 | return false;
100 | }
101 |
102 | @Override
103 | public Command getSchemaManagementCmd() {
104 | return null;
105 | }
106 |
107 | // Disable due to GraalVM (uses reflection)
108 |
109 | @Override
110 | public void initExpressionEnhancers() {
111 |
112 | }
113 |
114 | @Override
115 | public void initShortHandExpressionFunctions() {
116 |
117 | }
118 |
119 | @Override
120 | public void initFunctionDelegates() {
121 |
122 | }
123 |
124 | @Override
125 | public void initScriptingEngines() {
126 |
127 | }
128 |
129 | // Default entityCacheFactory uses reflection
130 |
131 | @Override
132 | public void initSessionFactories() {
133 | super.initSessionFactories();
134 |
135 | sessionFactories.put(EntityCache.class, new SessionFactory() {
136 |
137 | @Override
138 | public Class> getSessionType() {
139 | return EntityCache.class;
140 | }
141 | @Override
142 | public Session openSession(CommandContext commandContext) {
143 | return new EntityCacheImpl();
144 | }
145 | });
146 | }
147 |
148 |
149 |
150 | }
151 |
--------------------------------------------------------------------------------
/flowable-serverless/src/main/java/org/flowable/serverless/ServerlessUtil.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.serverless;
14 |
15 | import org.flowable.bpmn.model.BpmnModel;
16 | import org.flowable.common.engine.impl.event.FlowableEventSupport;
17 | import org.flowable.common.engine.impl.interceptor.Command;
18 | import org.flowable.common.engine.impl.interceptor.CommandContext;
19 | import org.flowable.common.engine.impl.persistence.deploy.DeploymentCache;
20 | import org.flowable.engine.ProcessEngine;
21 | import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
22 | import org.flowable.engine.impl.persistence.deploy.ProcessDefinitionCacheEntry;
23 | import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl;
24 | import org.flowable.engine.repository.ProcessDefinition;
25 |
26 | /**
27 | * For demo purposes, quick access to proc def.
28 | */
29 | public class ServerlessUtil {
30 |
31 | public static String PROCESS_DEFINITION_ID = "theProcess";
32 |
33 | public static ProcessDefinition PROCESS_DEFINITION;
34 |
35 | public static ProcessEngine initializeProcessEngineForBpmnModel(Command bpmnModelCommand) {
36 |
37 | long start = System.currentTimeMillis();
38 |
39 | NoDbProcessEngineConfiguration engineConfiguration = new NoDbProcessEngineConfiguration();
40 | ProcessEngine processEngine = engineConfiguration.buildProcessEngine();
41 |
42 | BpmnModel bpmnModel = processEngine.getManagementService().executeCommand(bpmnModelCommand);
43 |
44 | // TODO: move to processor?
45 | bpmnModel.setEventSupport(new FlowableEventSupport());
46 |
47 | // This is trickier to move
48 | Util.processFlowElements(bpmnModel.getMainProcess().getFlowElements(), bpmnModel.getMainProcess());
49 |
50 | // END TODO
51 |
52 | ServerlessUtil.deployServerlessProcessDefinition(bpmnModel, engineConfiguration);
53 |
54 | long end = System.currentTimeMillis();
55 | System.out.println("Flowable engine booted up in " + (end - start) + " ms");
56 |
57 | return processEngine;
58 | }
59 |
60 | public static void deployServerlessProcessDefinition(BpmnModel bpmnModel, ProcessEngineConfigurationImpl engineConfiguration) {
61 | PROCESS_DEFINITION = new ProcessDefinitionEntityImpl();
62 | ((ProcessDefinitionEntityImpl) PROCESS_DEFINITION).setId(PROCESS_DEFINITION_ID);
63 | ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(PROCESS_DEFINITION, bpmnModel, bpmnModel.getMainProcess());
64 |
65 | DeploymentCache processDefinitionCache = engineConfiguration.getProcessDefinitionCache();
66 | processDefinitionCache.add(PROCESS_DEFINITION_ID, cacheEntry);
67 |
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/flowable-serverless/src/main/java/org/flowable/serverless/Util.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.serverless;
14 |
15 | import java.util.Collection;
16 |
17 | import org.apache.commons.lang3.StringUtils;
18 | import org.flowable.bpmn.model.Activity;
19 | import org.flowable.bpmn.model.BaseElement;
20 | import org.flowable.bpmn.model.BoundaryEvent;
21 | import org.flowable.bpmn.model.FlowElement;
22 | import org.flowable.bpmn.model.FlowNode;
23 | import org.flowable.bpmn.model.Process;
24 | import org.flowable.bpmn.model.SequenceFlow;
25 | import org.flowable.bpmn.model.SubProcess;
26 |
27 | /**
28 | * Temporary. Taken from BpmnXMLConverter.
29 | */
30 | public class Util {
31 |
32 | public static void processFlowElements(Collection flowElementList, BaseElement parentScope) {
33 | for (FlowElement flowElement : flowElementList) {
34 | if (flowElement instanceof SequenceFlow) {
35 | SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
36 | FlowNode sourceNode = getFlowNodeFromScope(sequenceFlow.getSourceRef(), parentScope);
37 | if (sourceNode != null) {
38 | sourceNode.getOutgoingFlows().add(sequenceFlow);
39 | sequenceFlow.setSourceFlowElement(sourceNode);
40 | }
41 |
42 | FlowNode targetNode = getFlowNodeFromScope(sequenceFlow.getTargetRef(), parentScope);
43 | if (targetNode != null) {
44 | targetNode.getIncomingFlows().add(sequenceFlow);
45 | sequenceFlow.setTargetFlowElement(targetNode);
46 | }
47 |
48 | } else if (flowElement instanceof BoundaryEvent) {
49 | BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
50 | FlowElement attachedToElement = getFlowNodeFromScope(boundaryEvent.getAttachedToRefId(), parentScope);
51 | if (attachedToElement instanceof Activity) {
52 | Activity attachedActivity = (Activity) attachedToElement;
53 | boundaryEvent.setAttachedToRef(attachedActivity);
54 | attachedActivity.getBoundaryEvents().add(boundaryEvent);
55 | }
56 |
57 | } else if (flowElement instanceof SubProcess) {
58 | SubProcess subProcess = (SubProcess) flowElement;
59 | processFlowElements(subProcess.getFlowElements(), subProcess);
60 | }
61 | }
62 | }
63 |
64 | public static FlowNode getFlowNodeFromScope(String elementId, BaseElement scope) {
65 | FlowNode flowNode = null;
66 | if (StringUtils.isNotEmpty(elementId)) {
67 | if (scope instanceof Process) {
68 | flowNode = (FlowNode) ((Process) scope).getFlowElement(elementId);
69 | } else if (scope instanceof SubProcess) {
70 | flowNode = (FlowNode) ((SubProcess) scope).getFlowElement(elementId);
71 | }
72 | }
73 | return flowNode;
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/micronaut-sample-process/.gitignore:
--------------------------------------------------------------------------------
1 | Thumbs.db
2 | .DS_Store
3 | .gradle
4 | build/
5 | target/
6 | out/
7 | .idea
8 | *.iml
9 | *.ipr
10 | *.iws
11 | .project
12 | .settings
13 | .classpath
--------------------------------------------------------------------------------
/micronaut-sample-process/.mvn/jvm.config:
--------------------------------------------------------------------------------
1 | -noverify -XX:TieredStopAtLevel=1
--------------------------------------------------------------------------------
/micronaut-sample-process/.mvn/wrapper/MavenWrapperDownloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | import java.net.*;
21 | import java.io.*;
22 | import java.nio.channels.*;
23 | import java.util.Properties;
24 |
25 | public class MavenWrapperDownloader {
26 |
27 | /**
28 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
29 | */
30 | private static final String DEFAULT_DOWNLOAD_URL =
31 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar";
32 |
33 | /**
34 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
35 | * use instead of the default one.
36 | */
37 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
38 | ".mvn/wrapper/maven-wrapper.properties";
39 |
40 | /**
41 | * Path where the maven-wrapper.jar will be saved to.
42 | */
43 | private static final String MAVEN_WRAPPER_JAR_PATH =
44 | ".mvn/wrapper/maven-wrapper.jar";
45 |
46 | /**
47 | * Name of the property which should be used to override the default download url for the wrapper.
48 | */
49 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
50 |
51 | public static void main(String args[]) {
52 | System.out.println("- Downloader started");
53 | File baseDirectory = new File(args[0]);
54 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
55 |
56 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
57 | // wrapperUrl parameter.
58 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
59 | String url = DEFAULT_DOWNLOAD_URL;
60 | if(mavenWrapperPropertyFile.exists()) {
61 | FileInputStream mavenWrapperPropertyFileInputStream = null;
62 | try {
63 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
64 | Properties mavenWrapperProperties = new Properties();
65 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
66 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
67 | } catch (IOException e) {
68 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
69 | } finally {
70 | try {
71 | if(mavenWrapperPropertyFileInputStream != null) {
72 | mavenWrapperPropertyFileInputStream.close();
73 | }
74 | } catch (IOException e) {
75 | // Ignore ...
76 | }
77 | }
78 | }
79 | System.out.println("- Downloading from: : " + url);
80 |
81 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
82 | if(!outputFile.getParentFile().exists()) {
83 | if(!outputFile.getParentFile().mkdirs()) {
84 | System.out.println(
85 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
86 | }
87 | }
88 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
89 | try {
90 | downloadFileFromURL(url, outputFile);
91 | System.out.println("Done");
92 | System.exit(0);
93 | } catch (Throwable e) {
94 | System.out.println("- Error downloading");
95 | e.printStackTrace();
96 | System.exit(1);
97 | }
98 | }
99 |
100 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
101 | URL website = new URL(urlString);
102 | ReadableByteChannel rbc;
103 | rbc = Channels.newChannel(website.openStream());
104 | FileOutputStream fos = new FileOutputStream(destination);
105 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
106 | fos.close();
107 | rbc.close();
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/micronaut-sample-process/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flowable/flowable-serverless/f7fa32a596c7ea76f79a3e22887d04ef6fb44115/micronaut-sample-process/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/micronaut-sample-process/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
--------------------------------------------------------------------------------
/micronaut-sample-process/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 | micronaut-sample-process
4 |
5 |
6 | org.flowable.experimental
7 | flowable-serverless-parent
8 | 6.4.0-SNAPSHOT
9 |
10 |
11 |
12 | 6.4.0-SNAPSHOT
13 |
14 |
15 |
16 |
17 | org.flowable.experimental
18 | flowable-processor-annotations
19 | ${project.version}
20 |
21 |
22 | org.flowable.experimental
23 | flowable-processor
24 | ${project.version}
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/micronaut-sample-process/src/main/java/org.flowable/app/StartToEndProcess.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.app;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | /**
18 | * The annotation processor from Micronaut seems to disable the one from Flowable, if they are in the same project.
19 | * Hence that the process is moved to a separate module.
20 | */
21 | @Bpmn(resource = "processes/start-to-end.bpmn20.xml")
22 | public class StartToEndProcess {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/micronaut-sample-process/src/main/java/org.flowable/app/TestProcess.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.app;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | @Bpmn(resource = "processes/test-process.bpmn20.xml")
18 | public class TestProcess {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/micronaut-sample-process/src/main/resources/processes/start-to-end.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/micronaut-sample-process/src/main/resources/processes/test-process.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/micronaut-sample/.gitignore:
--------------------------------------------------------------------------------
1 | Thumbs.db
2 | .DS_Store
3 | .gradle
4 | build/
5 | target/
6 | out/
7 | .idea
8 | *.iml
9 | *.ipr
10 | *.iws
11 | .project
12 | .settings
13 | .classpath
--------------------------------------------------------------------------------
/micronaut-sample/.mvn/jvm.config:
--------------------------------------------------------------------------------
1 | -noverify -XX:TieredStopAtLevel=1
--------------------------------------------------------------------------------
/micronaut-sample/.mvn/wrapper/MavenWrapperDownloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | import java.net.*;
21 | import java.io.*;
22 | import java.nio.channels.*;
23 | import java.util.Properties;
24 |
25 | public class MavenWrapperDownloader {
26 |
27 | /**
28 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
29 | */
30 | private static final String DEFAULT_DOWNLOAD_URL =
31 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar";
32 |
33 | /**
34 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
35 | * use instead of the default one.
36 | */
37 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
38 | ".mvn/wrapper/maven-wrapper.properties";
39 |
40 | /**
41 | * Path where the maven-wrapper.jar will be saved to.
42 | */
43 | private static final String MAVEN_WRAPPER_JAR_PATH =
44 | ".mvn/wrapper/maven-wrapper.jar";
45 |
46 | /**
47 | * Name of the property which should be used to override the default download url for the wrapper.
48 | */
49 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
50 |
51 | public static void main(String args[]) {
52 | System.out.println("- Downloader started");
53 | File baseDirectory = new File(args[0]);
54 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
55 |
56 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
57 | // wrapperUrl parameter.
58 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
59 | String url = DEFAULT_DOWNLOAD_URL;
60 | if(mavenWrapperPropertyFile.exists()) {
61 | FileInputStream mavenWrapperPropertyFileInputStream = null;
62 | try {
63 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
64 | Properties mavenWrapperProperties = new Properties();
65 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
66 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
67 | } catch (IOException e) {
68 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
69 | } finally {
70 | try {
71 | if(mavenWrapperPropertyFileInputStream != null) {
72 | mavenWrapperPropertyFileInputStream.close();
73 | }
74 | } catch (IOException e) {
75 | // Ignore ...
76 | }
77 | }
78 | }
79 | System.out.println("- Downloading from: : " + url);
80 |
81 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
82 | if(!outputFile.getParentFile().exists()) {
83 | if(!outputFile.getParentFile().mkdirs()) {
84 | System.out.println(
85 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
86 | }
87 | }
88 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
89 | try {
90 | downloadFileFromURL(url, outputFile);
91 | System.out.println("Done");
92 | System.exit(0);
93 | } catch (Throwable e) {
94 | System.out.println("- Error downloading");
95 | e.printStackTrace();
96 | System.exit(1);
97 | }
98 | }
99 |
100 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
101 | URL website = new URL(urlString);
102 | ReadableByteChannel rbc;
103 | rbc = Channels.newChannel(website.openStream());
104 | FileOutputStream fos = new FileOutputStream(destination);
105 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
106 | fos.close();
107 | rbc.close();
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/micronaut-sample/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flowable/flowable-serverless/f7fa32a596c7ea76f79a3e22887d04ef6fb44115/micronaut-sample/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/micronaut-sample/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
--------------------------------------------------------------------------------
/micronaut-sample/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM oracle/graalvm-ce:1.0.0-rc8
2 | EXPOSE 8080
3 | COPY target/my-app-*.jar my-app.jar
4 | ADD . target
5 | RUN java -cp my-app.jar io.micronaut.graal.reflect.GraalClassLoadingAnalyzer
6 | RUN native-image --no-server \
7 | --class-path my-app.jar \
8 | -H:ReflectionConfigurationFiles=target/reflect.json \
9 | -H:EnableURLProtocols=http \
10 | -H:IncludeResources="logback.xml|application.yml|META-INF/services/*.*" \
11 | -H:Name=my-app \
12 | -H:Class=my.app.Application \
13 | -H:+ReportUnsupportedElementsAtRuntime \
14 | -H:+AllowVMInspection \
15 | -H:-UseServiceLoaderFeature \
16 | --rerun-class-initialization-at-runtime='sun.security.jca.JCAUtil$CachedSecureRandomHolder,javax.net.ssl.SSLContext' \
17 | --delay-class-initialization-to-runtime=io.netty.handler.codec.http.HttpObjectEncoder,io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder,io.netty.handler.ssl.util.ThreadLocalInsecureRandom,com.sun.jndi.dns.DnsClient
18 | ENTRYPOINT ["./my-app"]
--------------------------------------------------------------------------------
/micronaut-sample/DockerfileAllInOne:
--------------------------------------------------------------------------------
1 | FROM maven:3.6.0-jdk-8-alpine as builder
2 | COPY . /root/app/
3 | WORKDIR /root/app
4 | RUN mvn install
5 |
6 | FROM oracle/graalvm-ce:1.0.0-rc8 as graalvm
7 | COPY --from=builder /root/app/ /home/app/
8 | WORKDIR /home/app
9 | RUN java -cp target/my-app-0.1.jar \
10 | io.micronaut.graal.reflect.GraalClassLoadingAnalyzer \
11 | reflect.json
12 | RUN native-image --no-server \
13 | --class-path target/my-app-0.1.jar \
14 | -H:ReflectionConfigurationFiles=/home/app/reflect.json \
15 | -H:EnableURLProtocols=http \
16 | -H:IncludeResources='logback.xml|application.yml|META-INF/services/*.*' \
17 | -H:+ReportUnsupportedElementsAtRuntime \
18 | -H:+AllowVMInspection \
19 | --rerun-class-initialization-at-runtime='sun.security.jca.JCAUtil$CachedSecureRandomHolder',javax.net.ssl.SSLContext \
20 | --delay-class-initialization-to-runtime=io.netty.handler.codec.http.HttpObjectEncoder,io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder,io.netty.handler.ssl.util.ThreadLocalInsecureRandom \
21 | -H:-UseServiceLoaderFeature \
22 | -H:Name=my-app \
23 | -H:Class=my.app.Application
24 |
25 |
26 | FROM frolvlad/alpine-glibc
27 | EXPOSE 8080
28 | COPY --from=graalvm /home/app/my-app .
29 | ENTRYPOINT ["./my-app"]
30 |
31 |
--------------------------------------------------------------------------------
/micronaut-sample/build-native-image.sh:
--------------------------------------------------------------------------------
1 | ./mvnw package
2 | java -cp target/flowable-micronaut-app.jar io.micronaut.graal.reflect.GraalClassLoadingAnalyzer
3 | native-image --no-server \
4 | --allow-incomplete-classpath \
5 | --delay-class-initialization-to-runtime=sun.font.SunLayoutEngine \
6 | --delay-class-initialization-to-runtime=io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator \
7 | --delay-class-initialization-to-runtime=io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator \
8 | --delay-class-initialization-to-runtime=io.netty.handler.ssl.ReferenceCountedOpenSslEngine \
9 | --enable-url-protocols=https \
10 | --enable-all-security-services \
11 | --class-path target/flowable-micronaut-app.jar \
12 | -H:ReflectionConfigurationFiles=target/reflect.json,target/classes/custom-reflect.json \
13 | -H:EnableURLProtocols=http \
14 | -H:IncludeResources="logback.xml|application.yml|META-INF/services/*.*" \
15 | -H:Name=flowable-micronaut-app \
16 | -H:Class=org.flowable.app.Application \
17 | -H:+ReportUnsupportedElementsAtRuntime \
18 | -H:+AllowVMInspection \
19 | -H:-UseServiceLoaderFeature \
20 | --rerun-class-initialization-at-runtime='sun.security.jca.JCAUtil$CachedSecureRandomHolder,javax.net.ssl.SSLContext' \
21 | --delay-class-initialization-to-runtime=io.netty.handler.codec.http.HttpObjectEncoder,io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder,io.netty.handler.ssl.util.ThreadLocalInsecureRandom,com.sun.jndi.dns.DnsClient
22 |
--------------------------------------------------------------------------------
/micronaut-sample/dependency-reduced-pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | flowable-serverless-parent
5 | org.flowable.experimental
6 | 6.4.0-SNAPSHOT
7 |
8 | 4.0.0
9 | micronaut-sample-app
10 |
11 | flowable-micronaut-app
12 |
13 |
14 |
15 | maven-compiler-plugin
16 |
17 |
18 | test-compile
19 |
20 | testCompile
21 |
22 |
23 |
24 | -parameters
25 |
26 |
27 |
28 | io.micronaut
29 | micronaut-inject-java
30 | ${micronaut.version}
31 |
32 |
33 | io.micronaut
34 | micronaut-validation
35 | ${micronaut.version}
36 |
37 |
38 |
39 |
40 |
41 |
42 | ${jdk.version}
43 | ${jdk.version}
44 | UTF-8
45 |
46 | -parameters
47 |
48 |
49 |
50 | io.micronaut
51 | micronaut-inject-java
52 | ${micronaut.version}
53 |
54 |
55 | io.micronaut
56 | micronaut-validation
57 | ${micronaut.version}
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | maven-shade-plugin
67 | 3.1.0
68 |
69 |
70 | package
71 |
72 | shade
73 |
74 |
75 |
76 |
77 | ${exec.mainClass}
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | org.codehaus.mojo
87 | exec-maven-plugin
88 | 1.6.0
89 |
90 | java
91 |
92 | -noverify
93 | -XX:TieredStopAtLevel=1
94 | -classpath
95 |
96 | ${exec.mainClass}
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | jcenter.bintray.com
105 | https://jcenter.bintray.com
106 |
107 |
108 |
109 |
110 | com.oracle.substratevm
111 | svm
112 | 1.0.0-rc8
113 | provided
114 |
115 |
116 | svm-hosted-native-linux-amd64
117 | com.oracle.substratevm
118 |
119 |
120 | svm-hosted-native-darwin-amd64
121 | com.oracle.substratevm
122 |
123 |
124 | graal-sdk
125 | org.graalvm.sdk
126 |
127 |
128 | objectfile
129 | com.oracle.substratevm
130 |
131 |
132 | pointsto
133 | com.oracle.substratevm
134 |
135 |
136 | truffle-nfi
137 | org.graalvm.truffle
138 |
139 |
140 | compiler
141 | org.graalvm.compiler
142 |
143 |
144 |
145 |
146 | io.micronaut
147 | micronaut-inject-java
148 | 1.0.2
149 | provided
150 |
151 |
152 | junit
153 | junit
154 | 4.12
155 | test
156 |
157 |
158 | hamcrest-core
159 | org.hamcrest
160 |
161 |
162 |
163 |
164 | org.hamcrest
165 | hamcrest-all
166 | 1.3
167 | test
168 |
169 |
170 |
171 |
172 |
173 | io.micronaut
174 | micronaut-bom
175 | ${micronaut.version}
176 | pom
177 | import
178 |
179 |
180 |
181 |
182 | 6.4.0-SNAPSHOT
183 | 1.8
184 | org.flowable.app.Application
185 | UTF-8
186 | 1.0.2
187 |
188 |
189 |
190 |
--------------------------------------------------------------------------------
/micronaut-sample/docker-build.sh:
--------------------------------------------------------------------------------
1 | ./mvnw package
2 | docker build . -t my-app
3 | docker run --network host my-app
4 |
--------------------------------------------------------------------------------
/micronaut-sample/micronaut-cli.yml:
--------------------------------------------------------------------------------
1 | profile: service
2 | defaultPackage: my.app
3 | ---
4 | testFramework: junit
5 | sourceLanguage: java
--------------------------------------------------------------------------------
/micronaut-sample/mvnw:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | # ----------------------------------------------------------------------------
20 |
21 | # ----------------------------------------------------------------------------
22 | # Maven2 Start Up Batch script
23 | #
24 | # Required ENV vars:
25 | # ------------------
26 | # JAVA_HOME - location of a JDK home dir
27 | #
28 | # Optional ENV vars
29 | # -----------------
30 | # M2_HOME - location of maven2's installed home dir
31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven
32 | # e.g. to debug Maven itself, use
33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35 | # ----------------------------------------------------------------------------
36 |
37 | if [ -z "$MAVEN_SKIP_RC" ] ; then
38 |
39 | if [ -f /etc/mavenrc ] ; then
40 | . /etc/mavenrc
41 | fi
42 |
43 | if [ -f "$HOME/.mavenrc" ] ; then
44 | . "$HOME/.mavenrc"
45 | fi
46 |
47 | fi
48 |
49 | # OS specific support. $var _must_ be set to either true or false.
50 | cygwin=false;
51 | darwin=false;
52 | mingw=false
53 | case "`uname`" in
54 | CYGWIN*) cygwin=true ;;
55 | MINGW*) mingw=true;;
56 | Darwin*) darwin=true
57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59 | if [ -z "$JAVA_HOME" ]; then
60 | if [ -x "/usr/libexec/java_home" ]; then
61 | export JAVA_HOME="`/usr/libexec/java_home`"
62 | else
63 | export JAVA_HOME="/Library/Java/Home"
64 | fi
65 | fi
66 | ;;
67 | esac
68 |
69 | if [ -z "$JAVA_HOME" ] ; then
70 | if [ -r /etc/gentoo-release ] ; then
71 | JAVA_HOME=`java-config --jre-home`
72 | fi
73 | fi
74 |
75 | if [ -z "$M2_HOME" ] ; then
76 | ## resolve links - $0 may be a link to maven's home
77 | PRG="$0"
78 |
79 | # need this for relative symlinks
80 | while [ -h "$PRG" ] ; do
81 | ls=`ls -ld "$PRG"`
82 | link=`expr "$ls" : '.*-> \(.*\)$'`
83 | if expr "$link" : '/.*' > /dev/null; then
84 | PRG="$link"
85 | else
86 | PRG="`dirname "$PRG"`/$link"
87 | fi
88 | done
89 |
90 | saveddir=`pwd`
91 |
92 | M2_HOME=`dirname "$PRG"`/..
93 |
94 | # make it fully qualified
95 | M2_HOME=`cd "$M2_HOME" && pwd`
96 |
97 | cd "$saveddir"
98 | # echo Using m2 at $M2_HOME
99 | fi
100 |
101 | # For Cygwin, ensure paths are in UNIX format before anything is touched
102 | if $cygwin ; then
103 | [ -n "$M2_HOME" ] &&
104 | M2_HOME=`cygpath --unix "$M2_HOME"`
105 | [ -n "$JAVA_HOME" ] &&
106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
107 | [ -n "$CLASSPATH" ] &&
108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
109 | fi
110 |
111 | # For Mingw, ensure paths are in UNIX format before anything is touched
112 | if $mingw ; then
113 | [ -n "$M2_HOME" ] &&
114 | M2_HOME="`(cd "$M2_HOME"; pwd)`"
115 | [ -n "$JAVA_HOME" ] &&
116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117 | # TODO classpath?
118 | fi
119 |
120 | if [ -z "$JAVA_HOME" ]; then
121 | javaExecutable="`which javac`"
122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
123 | # readlink(1) is not available as standard on Solaris 10.
124 | readLink=`which readlink`
125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
126 | if $darwin ; then
127 | javaHome="`dirname \"$javaExecutable\"`"
128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
129 | else
130 | javaExecutable="`readlink -f \"$javaExecutable\"`"
131 | fi
132 | javaHome="`dirname \"$javaExecutable\"`"
133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'`
134 | JAVA_HOME="$javaHome"
135 | export JAVA_HOME
136 | fi
137 | fi
138 | fi
139 |
140 | if [ -z "$JAVACMD" ] ; then
141 | if [ -n "$JAVA_HOME" ] ; then
142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
143 | # IBM's JDK on AIX uses strange locations for the executables
144 | JAVACMD="$JAVA_HOME/jre/sh/java"
145 | else
146 | JAVACMD="$JAVA_HOME/bin/java"
147 | fi
148 | else
149 | JAVACMD="`which java`"
150 | fi
151 | fi
152 |
153 | if [ ! -x "$JAVACMD" ] ; then
154 | echo "Error: JAVA_HOME is not defined correctly." >&2
155 | echo " We cannot execute $JAVACMD" >&2
156 | exit 1
157 | fi
158 |
159 | if [ -z "$JAVA_HOME" ] ; then
160 | echo "Warning: JAVA_HOME environment variable is not set."
161 | fi
162 |
163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
164 |
165 | # traverses directory structure from process work directory to filesystem root
166 | # first directory with .mvn subdirectory is considered project base directory
167 | find_maven_basedir() {
168 |
169 | if [ -z "$1" ]
170 | then
171 | echo "Path not specified to find_maven_basedir"
172 | return 1
173 | fi
174 |
175 | basedir="$1"
176 | wdir="$1"
177 | while [ "$wdir" != '/' ] ; do
178 | if [ -d "$wdir"/.mvn ] ; then
179 | basedir=$wdir
180 | break
181 | fi
182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc)
183 | if [ -d "${wdir}" ]; then
184 | wdir=`cd "$wdir/.."; pwd`
185 | fi
186 | # end of workaround
187 | done
188 | echo "${basedir}"
189 | }
190 |
191 | # concatenates all lines of a file
192 | concat_lines() {
193 | if [ -f "$1" ]; then
194 | echo "$(tr -s '\n' ' ' < "$1")"
195 | fi
196 | }
197 |
198 | BASE_DIR=`find_maven_basedir "$(pwd)"`
199 | if [ -z "$BASE_DIR" ]; then
200 | exit 1;
201 | fi
202 |
203 | ##########################################################################################
204 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
205 | # This allows using the maven wrapper in projects that prohibit checking in binary data.
206 | ##########################################################################################
207 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
208 | if [ "$MVNW_VERBOSE" = true ]; then
209 | echo "Found .mvn/wrapper/maven-wrapper.jar"
210 | fi
211 | else
212 | if [ "$MVNW_VERBOSE" = true ]; then
213 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
214 | fi
215 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"
216 | while IFS="=" read key value; do
217 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
218 | esac
219 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
220 | if [ "$MVNW_VERBOSE" = true ]; then
221 | echo "Downloading from: $jarUrl"
222 | fi
223 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
224 |
225 | if command -v wget > /dev/null; then
226 | if [ "$MVNW_VERBOSE" = true ]; then
227 | echo "Found wget ... using wget"
228 | fi
229 | wget "$jarUrl" -O "$wrapperJarPath"
230 | elif command -v curl > /dev/null; then
231 | if [ "$MVNW_VERBOSE" = true ]; then
232 | echo "Found curl ... using curl"
233 | fi
234 | curl -o "$wrapperJarPath" "$jarUrl"
235 | else
236 | if [ "$MVNW_VERBOSE" = true ]; then
237 | echo "Falling back to using Java to download"
238 | fi
239 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
240 | if [ -e "$javaClass" ]; then
241 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
242 | if [ "$MVNW_VERBOSE" = true ]; then
243 | echo " - Compiling MavenWrapperDownloader.java ..."
244 | fi
245 | # Compiling the Java class
246 | ("$JAVA_HOME/bin/javac" "$javaClass")
247 | fi
248 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
249 | # Running the downloader
250 | if [ "$MVNW_VERBOSE" = true ]; then
251 | echo " - Running MavenWrapperDownloader.java ..."
252 | fi
253 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
254 | fi
255 | fi
256 | fi
257 | fi
258 | ##########################################################################################
259 | # End of extension
260 | ##########################################################################################
261 |
262 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
263 | if [ "$MVNW_VERBOSE" = true ]; then
264 | echo $MAVEN_PROJECTBASEDIR
265 | fi
266 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
267 |
268 | # For Cygwin, switch paths to Windows format before running java
269 | if $cygwin; then
270 | [ -n "$M2_HOME" ] &&
271 | M2_HOME=`cygpath --path --windows "$M2_HOME"`
272 | [ -n "$JAVA_HOME" ] &&
273 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
274 | [ -n "$CLASSPATH" ] &&
275 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
276 | [ -n "$MAVEN_PROJECTBASEDIR" ] &&
277 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
278 | fi
279 |
280 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
281 |
282 | exec "$JAVACMD" \
283 | $MAVEN_OPTS \
284 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
285 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
286 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
287 |
--------------------------------------------------------------------------------
/micronaut-sample/mvnw.cmd:
--------------------------------------------------------------------------------
1 | @REM ----------------------------------------------------------------------------
2 | @REM Licensed to the Apache Software Foundation (ASF) under one
3 | @REM or more contributor license agreements. See the NOTICE file
4 | @REM distributed with this work for additional information
5 | @REM regarding copyright ownership. The ASF licenses this file
6 | @REM to you under the Apache License, Version 2.0 (the
7 | @REM "License"); you may not use this file except in compliance
8 | @REM with the License. You may obtain a copy of the License at
9 | @REM
10 | @REM http://www.apache.org/licenses/LICENSE-2.0
11 | @REM
12 | @REM Unless required by applicable law or agreed to in writing,
13 | @REM software distributed under the License is distributed on an
14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | @REM KIND, either express or implied. See the License for the
16 | @REM specific language governing permissions and limitations
17 | @REM under the License.
18 | @REM ----------------------------------------------------------------------------
19 |
20 | @REM ----------------------------------------------------------------------------
21 | @REM Maven2 Start Up Batch script
22 | @REM
23 | @REM Required ENV vars:
24 | @REM JAVA_HOME - location of a JDK home dir
25 | @REM
26 | @REM Optional ENV vars
27 | @REM M2_HOME - location of maven2's installed home dir
28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31 | @REM e.g. to debug Maven itself, use
32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34 | @REM ----------------------------------------------------------------------------
35 |
36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37 | @echo off
38 | @REM set title of command window
39 | title %0
40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
42 |
43 | @REM set %HOME% to equivalent of $HOME
44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45 |
46 | @REM Execute a user defined script before this one
47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending
49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51 | :skipRcPre
52 |
53 | @setlocal
54 |
55 | set ERROR_CODE=0
56 |
57 | @REM To isolate internal variables from possible post scripts, we use another setlocal
58 | @setlocal
59 |
60 | @REM ==== START VALIDATION ====
61 | if not "%JAVA_HOME%" == "" goto OkJHome
62 |
63 | echo.
64 | echo Error: JAVA_HOME not found in your environment. >&2
65 | echo Please set the JAVA_HOME variable in your environment to match the >&2
66 | echo location of your Java installation. >&2
67 | echo.
68 | goto error
69 |
70 | :OkJHome
71 | if exist "%JAVA_HOME%\bin\java.exe" goto init
72 |
73 | echo.
74 | echo Error: JAVA_HOME is set to an invalid directory. >&2
75 | echo JAVA_HOME = "%JAVA_HOME%" >&2
76 | echo Please set the JAVA_HOME variable in your environment to match the >&2
77 | echo location of your Java installation. >&2
78 | echo.
79 | goto error
80 |
81 | @REM ==== END VALIDATION ====
82 |
83 | :init
84 |
85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86 | @REM Fallback to current working directory if not found.
87 |
88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90 |
91 | set EXEC_DIR=%CD%
92 | set WDIR=%EXEC_DIR%
93 | :findBaseDir
94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound
95 | cd ..
96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound
97 | set WDIR=%CD%
98 | goto findBaseDir
99 |
100 | :baseDirFound
101 | set MAVEN_PROJECTBASEDIR=%WDIR%
102 | cd "%EXEC_DIR%"
103 | goto endDetectBaseDir
104 |
105 | :baseDirNotFound
106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107 | cd "%EXEC_DIR%"
108 |
109 | :endDetectBaseDir
110 |
111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112 |
113 | @setlocal EnableExtensions EnableDelayedExpansion
114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116 |
117 | :endReadAdditionalConfig
118 |
119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122 |
123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"
124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
126 | )
127 |
128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
130 | if exist %WRAPPER_JAR% (
131 | echo Found %WRAPPER_JAR%
132 | ) else (
133 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
134 | echo Downloading from: %DOWNLOAD_URL%
135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
136 | echo Finished downloading %WRAPPER_JAR%
137 | )
138 | @REM End of extension
139 |
140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
141 | if ERRORLEVEL 1 goto error
142 | goto end
143 |
144 | :error
145 | set ERROR_CODE=1
146 |
147 | :end
148 | @endlocal & set ERROR_CODE=%ERROR_CODE%
149 |
150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
154 | :skipRcPost
155 |
156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
158 |
159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
160 |
161 | exit /B %ERROR_CODE%
162 |
--------------------------------------------------------------------------------
/micronaut-sample/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.flowable.experimental
6 | flowable-serverless-parent
7 | 6.4.0-SNAPSHOT
8 |
9 |
10 | micronaut-sample-app
11 |
12 |
13 | 1.0.2
14 | 1.8
15 | UTF-8
16 | org.flowable.app.Application
17 | 6.4.0-SNAPSHOT
18 |
19 |
20 |
21 |
22 | jcenter.bintray.com
23 | https://jcenter.bintray.com
24 |
25 |
26 |
27 |
28 |
29 | io.micronaut
30 | micronaut-bom
31 | ${micronaut.version}
32 | pom
33 | import
34 |
35 |
36 |
37 |
38 |
39 | io.micronaut
40 | micronaut-http-client
41 | compile
42 |
43 |
44 | io.micronaut
45 | micronaut-http-server-netty
46 | compile
47 |
48 |
49 | io.micronaut
50 | micronaut-inject
51 | compile
52 |
53 |
54 | io.micronaut
55 | micronaut-validation
56 | compile
57 |
58 |
59 | io.micronaut
60 | micronaut-runtime
61 | compile
62 |
63 |
64 | com.oracle.substratevm
65 | svm
66 | provided
67 |
68 |
69 | io.micronaut
70 | micronaut-inject-java
71 | provided
72 |
73 |
74 | ch.qos.logback
75 | logback-classic
76 | 1.2.3
77 | runtime
78 |
79 |
80 | io.micronaut
81 | micronaut-graal
82 | runtime
83 |
84 |
85 | junit
86 | junit
87 | 4.12
88 | test
89 |
90 |
91 | org.hamcrest
92 | hamcrest-all
93 | 1.3
94 | test
95 |
96 |
97 |
98 | org.flowable
99 | flowable-engine
100 |
101 |
102 |
103 | org.springframework
104 | spring-beans
105 |
106 |
107 | org.apache.commons
108 | commons-email
109 |
110 |
111 | org.slf4j
112 | jcl-over-slf4j
113 |
114 |
115 |
116 |
117 | org.flowable
118 | flowable-http
119 |
120 |
121 |
122 | org.flowable.experimental
123 | micronaut-sample-process
124 | ${project.version}
125 |
126 |
127 |
128 | org.flowable.experimental
129 | flowable-serverless
130 |
131 |
132 | org.flowable
133 | flowable-engine
134 |
135 |
136 |
137 |
138 |
139 |
140 | flowable-micronaut-app
141 |
142 |
143 | org.apache.maven.plugins
144 | maven-shade-plugin
145 | 3.1.0
146 |
147 |
148 | package
149 |
150 | shade
151 |
152 |
153 |
154 |
155 | ${exec.mainClass}
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 | org.codehaus.mojo
165 | exec-maven-plugin
166 | 1.6.0
167 |
168 | java
169 |
170 | -noverify
171 | -XX:TieredStopAtLevel=1
172 | -classpath
173 |
174 | ${exec.mainClass}
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 | org.apache.maven.plugins
183 | maven-compiler-plugin
184 |
185 | ${jdk.version}
186 | ${jdk.version}
187 | UTF-8
188 |
189 | -parameters
190 |
191 |
192 |
193 | io.micronaut
194 | micronaut-inject-java
195 | ${micronaut.version}
196 |
197 |
198 | io.micronaut
199 | micronaut-validation
200 | ${micronaut.version}
201 |
202 |
203 |
204 |
205 |
206 | test-compile
207 |
208 | testCompile
209 |
210 |
211 |
212 | -parameters
213 |
214 |
215 |
216 | io.micronaut
217 | micronaut-inject-java
218 | ${micronaut.version}
219 |
220 |
221 | io.micronaut
222 | micronaut-validation
223 | ${micronaut.version}
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
--------------------------------------------------------------------------------
/micronaut-sample/src/main/java/org.flowable/app/Application.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.app;
14 |
15 | import io.micronaut.runtime.Micronaut;
16 |
17 | /**
18 | * Try with
19 | *
20 | * curl -X POST -H "Content-Type: text/plain" --data 1 localhost:8083/process
21 | * curl -X POST -H "Content-Type: text/plain" --data 2 localhost:8083/process
22 | *
23 | * To build graalvm image, run ./build-native-image.sh
24 | */
25 | public class Application {
26 |
27 | public static void main(String[] args) {
28 | Micronaut.run(Application.class);
29 | }
30 | }
--------------------------------------------------------------------------------
/micronaut-sample/src/main/java/org.flowable/app/MicronautSubstitutions.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package my.app;
14 |
15 | import com.oracle.svm.core.annotate.Alias;
16 | import com.oracle.svm.core.annotate.RecomputeFieldValue;
17 | import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind;
18 | import com.oracle.svm.core.annotate.Substitute;
19 | import com.oracle.svm.core.annotate.TargetClass;
20 |
21 | import io.netty.util.internal.logging.InternalLoggerFactory;
22 | import io.netty.util.internal.logging.JdkLoggerFactory;
23 |
24 | @TargetClass(io.netty.util.internal.logging.InternalLoggerFactory.class)
25 | final class Target_io_netty_util_internal_logging_InternalLoggerFactory {
26 | @Substitute
27 | private static InternalLoggerFactory newDefaultFactory(String name) {
28 | return JdkLoggerFactory.INSTANCE;
29 | }
30 | }
31 |
32 | @TargetClass(className = "io.micronaut.caffeine.cache.UnsafeRefArrayAccess")
33 | final class Target_io_micronaut_caffeine_cache_UnsafeRefArrayAccess {
34 | @Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.ArrayIndexShift, declClass = Object[].class)
35 | public static int REF_ELEMENT_SHIFT;
36 | }
37 |
38 | @TargetClass(className = "io.netty.util.internal.PlatformDependent0")
39 | final class Target_io_netty_util_internal_PlatformDependent0 {
40 | @Alias @RecomputeFieldValue(kind = Kind.FieldOffset, //
41 | declClassName = "java.nio.Buffer", //
42 | name = "address") //
43 | private static long ADDRESS_FIELD_OFFSET;
44 | }
45 |
46 | @TargetClass(className = "io.netty.util.internal.CleanerJava6")
47 | final class Target_io_netty_util_internal_CleanerJava6 {
48 | @Alias @RecomputeFieldValue(kind = Kind.FieldOffset, //
49 | declClassName = "java.nio.DirectByteBuffer", //
50 | name = "cleaner") //
51 | private static long CLEANER_FIELD_OFFSET;
52 | }
53 |
54 | @TargetClass(className = "io.netty.util.internal.shaded.org.jctools.util.UnsafeRefArrayAccess")
55 | final class Target_io_netty_util_internal_shaded_org_jctools_util_UnsafeRefArrayAccess {
56 | @Alias @RecomputeFieldValue(kind = Kind.ArrayIndexShift, declClass = Object[].class) //
57 | public static int REF_ELEMENT_SHIFT;
58 | }
59 |
60 | public class MicronautSubstitutions {
61 | }
--------------------------------------------------------------------------------
/micronaut-sample/src/main/java/org.flowable/app/ProcessController.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.app;
14 |
15 | import java.util.HashMap;
16 | import java.util.Map;
17 |
18 | import org.flowable.bpmn.model.BpmnModel;
19 | import org.flowable.common.engine.impl.event.FlowableEventSupport;
20 | import org.flowable.common.engine.impl.interceptor.Command;
21 | import org.flowable.common.engine.impl.interceptor.CommandContext;
22 | import org.flowable.engine.ProcessEngine;
23 | import org.flowable.engine.runtime.ProcessInstance;
24 | import org.flowable.serverless.NoDbProcessEngineConfiguration;
25 | import org.flowable.serverless.ServerlessUtil;
26 | import org.flowable.serverless.Util;
27 |
28 | import io.micronaut.http.MediaType;
29 | import io.micronaut.http.annotation.Body;
30 | import io.micronaut.http.annotation.Controller;
31 | import io.micronaut.http.annotation.Post;
32 |
33 | @Controller("/process")
34 | public class ProcessController {
35 |
36 | public static ProcessEngine processEngine = ServerlessUtil.initializeProcessEngineForBpmnModel(
37 | commandContext -> TestProcessExample.createTestProcessExampleBpmnModel());
38 |
39 | @Post(consumes = MediaType.TEXT_PLAIN)
40 | public String post(@Body String id) {
41 | Map result = new HashMap<>();
42 |
43 | ProcessInstance processInstance = processEngine.getRuntimeService()
44 | .createProcessInstanceBuilder()
45 | .processDefinitionId(ServerlessUtil.PROCESS_DEFINITION_ID)
46 | .transientVariable("result", result)
47 | .variable("personId", id)
48 | .start();
49 |
50 | return "[Micronaut] new process instance " + processInstance.getId() + " : " + result;
51 | }
52 |
53 | }
--------------------------------------------------------------------------------
/micronaut-sample/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | micronaut:
2 | application:
3 | name: my-app
4 | server:
5 | port: 8083
--------------------------------------------------------------------------------
/micronaut-sample/src/main/resources/custom-reflect.json:
--------------------------------------------------------------------------------
1 | [ {
2 | "name" : "org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl",
3 | "allPublicMethods" : true,
4 | "allDeclaredConstructors" : true
5 | },
6 | {
7 | "name" : "java.util.HashMap",
8 | "allPublicMethods" : true,
9 | "allDeclaredConstructors" : true
10 | },
11 | {
12 | "name" : "org.flowable.common.engine.impl.de.odysseus.el.ExpressionFactoryImpl",
13 | "allPublicMethods" : true,
14 | "allDeclaredConstructors" : true
15 | }
16 | ]
--------------------------------------------------------------------------------
/micronaut-sample/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/processor/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.flowable.experimental
8 | flowable-serverless-parent
9 | 6.4.0-SNAPSHOT
10 |
11 |
12 | flowable-processor
13 |
14 |
15 |
16 |
17 | org.flowable.experimental
18 | flowable-processor-annotations
19 |
20 |
21 |
22 | org.flowable
23 | flowable-bpmn-model
24 |
25 |
26 | org.flowable
27 | flowable-bpmn-converter
28 |
29 |
30 | org.flowable
31 | flowable-engine
32 |
33 |
34 | org.flowable
35 | flowable-http
36 |
37 |
38 |
39 | com.squareup
40 | javapoet
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | org.apache.maven.plugins
49 | maven-compiler-plugin
50 |
51 |
52 | none
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/processor/src/main/java/org/flowable/experimental/processor/bpmn/BpmnModelProcessor.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.experimental.processor.bpmn;
14 |
15 | import java.io.File;
16 | import java.io.FileInputStream;
17 | import java.io.FileNotFoundException;
18 | import java.io.IOException;
19 | import java.io.InputStream;
20 | import java.io.UncheckedIOException;
21 | import java.util.Collection;
22 | import java.util.HashSet;
23 | import java.util.List;
24 | import java.util.Map;
25 | import java.util.Optional;
26 | import java.util.Set;
27 | import java.util.stream.Collectors;
28 | import java.util.stream.Stream;
29 |
30 | import javax.annotation.processing.AbstractProcessor;
31 | import javax.annotation.processing.ProcessingEnvironment;
32 | import javax.annotation.processing.RoundEnvironment;
33 | import javax.annotation.processing.SupportedAnnotationTypes;
34 | import javax.lang.model.element.AnnotationMirror;
35 | import javax.lang.model.element.AnnotationValue;
36 | import javax.lang.model.element.Element;
37 | import javax.lang.model.element.ExecutableElement;
38 | import javax.lang.model.element.TypeElement;
39 | import javax.tools.FileObject;
40 | import javax.tools.StandardLocation;
41 |
42 | import org.flowable.bpmn.converter.BpmnXMLConverter;
43 | import org.flowable.bpmn.model.BpmnModel;
44 | import org.flowable.experimental.bpmn.Bpmn;
45 | import org.flowable.experimental.bpmn.BpmnModels;
46 |
47 | import com.squareup.javapoet.JavaFile;
48 | import com.squareup.javapoet.TypeSpec;
49 |
50 | /**
51 | * @author Filip Hrisafov
52 | */
53 | @SupportedAnnotationTypes({
54 | "org.flowable.experimental.bpmn.Bpmn",
55 | "org.flowable.experimental.bpmn.BpmnModels"
56 | })
57 | public class BpmnModelProcessor extends AbstractProcessor {
58 |
59 | protected BpmnModelCreator bpmnModelCreator;
60 |
61 | @Override
62 | public synchronized void init(ProcessingEnvironment processingEnv) {
63 | super.init(processingEnv);
64 | bpmnModelCreator = new BpmnModelCreator(processingEnv);
65 | }
66 |
67 | @Override
68 | public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
69 |
70 | Set extends Element> bpmnElements = roundEnv.getElementsAnnotatedWith(Bpmn.class);
71 | for (Element element : bpmnElements) {
72 | processElement(element);
73 | }
74 |
75 | bpmnElements = roundEnv.getElementsAnnotatedWith(BpmnModels.class);
76 | for (Element element : bpmnElements) {
77 | processElement(element);
78 | }
79 |
80 | return false;
81 | }
82 |
83 | protected void processElement(Element element) {
84 | BpmnXMLConverter converter = new BpmnXMLConverter();
85 | for (BpmnPropertyHolder propertyHolder : collectBpmnPropertyHolders(element)) {
86 | String resource = propertyHolder.getResource();
87 | BpmnModel bpmnModel = converter.convertToBpmnModel(() -> getResourceStream(resource), true, true);
88 | bpmnModel.getProcesses().forEach(process -> process.setEnableEagerExecutionTreeFetching(propertyHolder.isEnableEagerExecutionTreeFetching()));
89 |
90 | TypeSpec type = bpmnModelCreator.createType(bpmnModel)
91 | .toBuilder()
92 | .addOriginatingElement(element)
93 | .build();
94 |
95 | String packageName = packageName(element);
96 | JavaFile javaFile = JavaFile.builder(packageName, type)
97 | .skipJavaLangImports(true)
98 | .indent(" ")
99 | .build();
100 |
101 | try {
102 | javaFile.writeTo(processingEnv.getFiler());
103 | } catch (IOException e) {
104 | throw new UncheckedIOException(e);
105 | }
106 | }
107 |
108 | }
109 |
110 | private String packageName(Element element) {
111 | return processingEnv.getElementUtils().getPackageOf(element).getQualifiedName().toString();
112 | }
113 |
114 | private InputStream getResourceStream(String resource) {
115 | try {
116 | // Most build systems will have copied the file to the class output location
117 | FileObject fileObject = this.processingEnv.getFiler()
118 | .getResource(StandardLocation.CLASS_OUTPUT, "", resource);
119 | File file = locateResourceFile(new File(fileObject.toUri()), resource);
120 | return file.exists() ?
121 | new FileInputStream(file)
122 | : fileObject.toUri().toURL().openStream();
123 | } catch (IOException ex) {
124 | throw new UncheckedIOException(ex);
125 | }
126 | }
127 |
128 | File locateResourceFile(File standardLocation, String resource) throws IOException {
129 | if (standardLocation.exists()) {
130 | return standardLocation;
131 | }
132 | return new File(locateGradleResourcesFolder(standardLocation), resource);
133 | }
134 |
135 | private File locateGradleResourcesFolder(File standardAdditionalMetadataLocation)
136 | throws FileNotFoundException {
137 | String path = standardAdditionalMetadataLocation.getPath();
138 | int index = path.lastIndexOf("classes");
139 | if (index < 0) {
140 | throw new FileNotFoundException();
141 | }
142 | String buildFolderPath = path.substring(0, index);
143 | File classOutputLocation = standardAdditionalMetadataLocation.getParentFile()
144 | .getParentFile();
145 | return new File(buildFolderPath,
146 | "resources" + '/' + classOutputLocation.getName());
147 | }
148 |
149 | private Collection collectBpmnPropertyHolders(Element element) {
150 | Set bpmnResources = new HashSet<>();
151 | for (AnnotationMirror annotation : element.getAnnotationMirrors()) {
152 | if (annotation.getAnnotationType().toString().equals("org.flowable.experimental.bpmn.Bpmn")) {
153 | getBpmnPropertyHolder(annotation).ifPresent(bpmnResources::add);
154 | } else if (annotation.getAnnotationType().toString().equals("org.flowable.experimental.bpmn.BpmnModels")) {
155 | bpmnResources.addAll(getBpmnPropertyHolders(annotation));
156 | }
157 | }
158 |
159 | return bpmnResources;
160 | }
161 |
162 | private List getBpmnPropertyHolders(AnnotationMirror annotationMirror) {
163 | return extractValue(annotationMirror, "value")
164 | .flatMap(this::getBpmn)
165 | .map(this::getBpmnPropertyHolder)
166 | .filter(Optional::isPresent)
167 | .map(Optional::get)
168 | .collect(Collectors.toList());
169 | }
170 |
171 | private Stream getBpmn(AnnotationValue annotationValue) {
172 | if (annotationValue == null) {
173 | return Stream.empty();
174 | }
175 |
176 | Object value = annotationValue.getValue();
177 | if (value instanceof List) {
178 | return ((List) value).stream();
179 | }
180 |
181 | return Stream.of((AnnotationMirror) value);
182 | }
183 |
184 | private Optional getBpmnPropertyHolder(AnnotationMirror annotation) {
185 | BpmnPropertyHolder.Builder builder = new BpmnPropertyHolder.Builder();
186 | for (Map.Entry extends ExecutableElement, ? extends AnnotationValue> entry : processingEnv.getElementUtils().getElementValuesWithDefaults(annotation).entrySet()) {
187 | String annotationName = entry.getKey().getSimpleName().toString();
188 | AnnotationValue annotationValue = entry.getValue();
189 | if (annotationName.equals("resource")) {
190 | builder.resource(getAnnotationValueAsString(annotationValue));
191 | } else if (annotationName.equals("enableEagerExecutionTreeFetching")) {
192 | builder.enableEagerExecutionTreeFetching(getAnnotationValueAsBoolean(annotationValue));
193 | }
194 | }
195 |
196 | if (builder.hasResource()) {
197 | return Optional.of(builder.create());
198 | } else {
199 | return Optional.empty();
200 | }
201 | }
202 |
203 | private String getAnnotationValueAsString(AnnotationValue annotationValue) {
204 | if (annotationValue == null) {
205 | return null;
206 | }
207 |
208 | return annotationValue.getValue().toString();
209 | }
210 |
211 | private boolean getAnnotationValueAsBoolean(AnnotationValue annotationValue) {
212 | if (annotationValue == null) {
213 | return false;
214 | }
215 |
216 | Object value = annotationValue.getValue();
217 | if (value instanceof Boolean) {
218 | return (boolean) value;
219 | }
220 | return false;
221 | }
222 |
223 | private Stream extractValue(AnnotationMirror annotation, String valueName) {
224 | return annotation.getElementValues()
225 | .entrySet()
226 | .stream()
227 | .filter(entry -> entry.getKey().getSimpleName().toString().equals(valueName))
228 | .map(Map.Entry::getValue);
229 | }
230 |
231 | }
232 |
--------------------------------------------------------------------------------
/processor/src/main/java/org/flowable/experimental/processor/bpmn/BpmnPropertyHolder.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.experimental.processor.bpmn;
14 |
15 | /**
16 | * @author Filip Hrisafov
17 | */
18 | public class BpmnPropertyHolder {
19 |
20 | protected final String resource;
21 | protected final boolean enableEagerExecutionTreeFetching;
22 |
23 | public BpmnPropertyHolder(String resource, boolean enableEagerExecutionTreeFetching) {
24 | this.resource = resource;
25 | this.enableEagerExecutionTreeFetching = enableEagerExecutionTreeFetching;
26 | }
27 |
28 | public String getResource() {
29 | return resource;
30 | }
31 |
32 | public boolean isEnableEagerExecutionTreeFetching() {
33 | return enableEagerExecutionTreeFetching;
34 | }
35 |
36 | public static class Builder {
37 |
38 | protected String resource;
39 | protected boolean enableEagerExecutionTreeFetching;
40 |
41 | public Builder resource(String resource) {
42 | this.resource = resource;
43 | return this;
44 | }
45 |
46 | public Builder enableEagerExecutionTreeFetching(boolean enableEagerExecutionTreeFetching) {
47 | this.enableEagerExecutionTreeFetching = enableEagerExecutionTreeFetching;
48 | return this;
49 | }
50 |
51 | public boolean hasResource() {
52 | return resource != null;
53 | }
54 |
55 | public BpmnPropertyHolder create() {
56 | return new BpmnPropertyHolder(resource, enableEagerExecutionTreeFetching);
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/processor/src/main/java/temp/CustomHttpActivityBehavior.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package temp;
14 |
15 | import java.net.HttpURLConnection;
16 | import java.net.URL;
17 | import java.util.List;
18 |
19 | import org.apache.commons.lang3.StringUtils;
20 | import org.flowable.bpmn.model.FieldExtension;
21 | import org.flowable.bpmn.model.ServiceTask;
22 | import org.flowable.common.engine.api.FlowableException;
23 | import org.flowable.common.engine.api.delegate.Expression;
24 | import org.flowable.engine.delegate.DelegateExecution;
25 | import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
26 | import org.flowable.engine.impl.util.CommandContextUtil;
27 |
28 | import com.fasterxml.jackson.databind.JsonNode;
29 | import com.fasterxml.jackson.databind.ObjectMapper;
30 |
31 | /**
32 | * Custom behavior for http call, as running the default one on Graal isn't possible due to java.util.Timer being created in the background
33 | *
34 | * Also need to add --enable-url-protocols=https to native image generation.
35 | *
36 | * Also need to enable security to read from https inputstream https://blog.taylorwood.io/2018/10/04/graalvm-https.html
37 | * (otherwise exception java.lang.UnsatisfiedLinkError: sun.security.ec.ECDSASignature.verifySignedDigest([B[B[B[B)Z [symbol: Java_sun_security_ec_ECDSASignature_verifySignedDigest or Java_sun_security_ec_ECDSASignature_verifySignedDigest___3B_3B_3B_3B])
38 | * And copy graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/libsunec.dyli to current directory (can't get it working with the system property yet)
39 | */
40 | public class CustomHttpActivityBehavior extends AbstractBpmnActivityBehavior {
41 |
42 | private Expression requestMethod;
43 | private Expression requestUrl;
44 | private Expression responseVariableName;
45 |
46 | public CustomHttpActivityBehavior(ServiceTask serviceTask) {
47 | List fieldExtensions = serviceTask.getFieldExtensions();
48 | for (FieldExtension fieldExtension : fieldExtensions) {
49 | if (fieldExtension.getFieldName().equals("requestMethod")) {
50 | this.requestMethod = createExpression(fieldExtension);
51 | } else if (fieldExtension.getFieldName().equals("requestUrl")) {
52 | this.requestUrl = createExpression(fieldExtension);
53 | } if (fieldExtension.getFieldName().equals("responseVariableName")) {
54 | this.responseVariableName = createExpression(fieldExtension);
55 | }
56 | }
57 | }
58 |
59 | @Override
60 | public void execute(DelegateExecution execution) {
61 | String method = (String) requestMethod.getValue(execution);
62 | String urlString = (String) requestUrl.getValue(execution);
63 | String variable = (String) responseVariableName.getValue(execution);
64 |
65 | try {
66 | URL url = new URL(urlString);
67 | HttpURLConnection con = (HttpURLConnection) url.openConnection();
68 | con.setRequestMethod(method.toUpperCase());
69 | con.setRequestProperty("User-Agent", "custom");
70 | con.setRequestProperty("Content-type", "application/json");
71 | con.setRequestProperty("Accept", "*/*");
72 |
73 | // BufferedReader in = new BufferedReader(
74 | // new InputStreamReader(con.getInputStream()));
75 | // String inputLine;
76 | // StringBuffer content = new StringBuffer();
77 | // while ((inputLine = in.readLine()) != null) {
78 | // content.append(inputLine);
79 | // }
80 | // in.close();
81 |
82 | ObjectMapper objectMapper = new ObjectMapper();
83 | JsonNode jsonNode = objectMapper.readTree(con.getInputStream());
84 | execution.setVariable(variable, jsonNode);
85 |
86 | con.disconnect();
87 |
88 | } catch (Exception e) {
89 | throw new FlowableException("Cannot execute http call", e);
90 | }
91 | leave(execution);
92 | }
93 |
94 | protected Expression createExpression(FieldExtension fieldExtension) {
95 | String expressionString = fieldExtension.getStringValue();
96 | if (StringUtils.isEmpty(expressionString)) {
97 | expressionString = fieldExtension.getExpression();
98 | }
99 | return CommandContextUtil.getProcessEngineConfiguration().getExpressionManager().createExpression(expressionString);
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/processor/src/main/java/temp/TempServiceTaskExpressionActivityBehavior.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package temp;
14 |
15 | import org.flowable.bpmn.model.ServiceTask;
16 | import org.flowable.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior;
17 | import org.flowable.engine.impl.util.CommandContextUtil;
18 |
19 | public class TempServiceTaskExpressionActivityBehavior extends ServiceTaskExpressionActivityBehavior {
20 |
21 | public TempServiceTaskExpressionActivityBehavior(ServiceTask serviceTask, String expressionString) {
22 | super(serviceTask, null, null);
23 |
24 | // TODO: cannot create expressions during generation with @Bpm, quick workaround:
25 | this.expression = CommandContextUtil.getProcessEngineConfiguration().getExpressionManager().createExpression(expressionString);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor:
--------------------------------------------------------------------------------
1 | org.flowable.experimental.processor.bpmn.BpmnModelProcessor
--------------------------------------------------------------------------------
/sample/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.flowable.experimental
8 | flowable-serverless-parent
9 | 6.4.0-SNAPSHOT
10 |
11 |
12 | flowable-processor-sample
13 |
14 |
15 |
16 | true
17 |
18 |
19 |
20 |
21 | org.flowable.experimental
22 | flowable-processor-annotations
23 |
24 |
25 | org.flowable.experimental
26 | flowable-processor
27 |
28 |
29 | org.flowable.experimental
30 | flowable-serverless
31 |
32 |
33 |
34 | org.flowable
35 | flowable-engine
36 |
37 |
38 |
39 | org.junit.jupiter
40 | junit-jupiter-engine
41 | test
42 |
43 |
44 |
45 | org.xmlunit
46 | xmlunit-assertj
47 | test
48 |
49 |
50 |
51 | org.slf4j
52 | slf4j-log4j12
53 | 1.7.5
54 | test
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/sample/src/main/java/experiment/MyJavaDelegate.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package experiment;
14 |
15 | import java.util.concurrent.atomic.AtomicInteger;
16 |
17 | import org.flowable.engine.delegate.DelegateExecution;
18 | import org.flowable.engine.delegate.JavaDelegate;
19 |
20 | public class MyJavaDelegate implements JavaDelegate {
21 |
22 | public static final AtomicInteger COUNTER = new AtomicInteger(0);
23 |
24 | @Override
25 | public void execute(DelegateExecution execution) {
26 | COUNTER.incrementAndGet();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/sample/src/main/java/experiment/StartProcessFunction.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package experiment;
14 |
15 | import org.flowable.engine.ProcessEngine;
16 | import org.flowable.sample.SimpleServiceTask;
17 | import org.flowable.serverless.ServerlessUtil;
18 |
19 | /**
20 | * The purpose of this experiment is to build a simple 'function' that starts a process definition.
21 | *
22 | * To boot up fast, we're using a custom proc engines config that doesn't have any persistency and disables MyBatis completely.
23 | * Also, the process should be ready as-is and not need any extra parsing, which means all behaviours are already set (TODO: discuss this point).
24 | *
25 | * This leads to the following problems though:
26 | *
27 | * - A normal deployment (through the repositoryService.createDeployment) can't happen, as there is no persistency.
28 | * So the process definition is passed into the cache directly (which currently needs some hacking like mimicking a ProcessDefinition)
29 | *
30 | * - When starting a process instance, the process definition can only be started by id
31 | * (by key would trigger a lookup in the data store)
32 | *
33 | * - TODO: Currently, the behaviours are set in the element in a hardcoded way.
34 | * It might be better to actually deploy the process to an in-mem db and get the parsed behaviors from it.
35 | * This might be too costly for annotation processing, probably.
36 | * Alternatively, the parsers should be changed to be reusable.
37 | */
38 | public class StartProcessFunction {
39 |
40 | public static ProcessEngine processEngine = ServerlessUtil.initializeProcessEngineForBpmnModel(commandContext -> SimpleServiceTask.createSimpleServiceTaskBpmnModel());;
41 |
42 | public static void main(String[] args) {
43 | int nrOfInstances = 100000;
44 | long start = System.currentTimeMillis();
45 | for (int i = 0; i < nrOfInstances; i++) {
46 | processEngine.getRuntimeService().startProcessInstanceById(ServerlessUtil.PROCESS_DEFINITION_ID);
47 | }
48 | long end = System.currentTimeMillis();
49 |
50 | if (MyJavaDelegate.COUNTER.get() != nrOfInstances) {
51 | throw new RuntimeException("Error: invalid number invocations of delegate: " + MyJavaDelegate.COUNTER.get());
52 | } else {
53 | long time = end - start;
54 | System.out.println("Started " + nrOfInstances + " processes in " + time + " ms, which is " + ( (double) time / (double) nrOfInstances ) + " ms per instance (and with only one thread)");
55 | }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/flowable/sample/AsyncProcesses.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | /**
18 | * @author Filip Hrisafov
19 | */
20 | @Bpmn(resource = "processes/proc-two-async-tasks.bpmn")
21 | public class AsyncProcesses {
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/flowable/sample/ExampleProcesses.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | /**
18 | * @author Filip Hrisafov
19 | */
20 | @Bpmn(resource = "processes/vacationRequest.bpmn20.xml")
21 | @Bpmn(resource = "processes/my-process.bpmn20.xml")
22 | public class ExampleProcesses {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/flowable/sample/SimpleServiceTaskProcess.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | @Bpmn(resource = "processes/simple-service-task.bpmn20.xml")
18 | public class SimpleServiceTaskProcess {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/flowable/sample/StartToEndProcess.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | @Bpmn(resource = "processes/start-to-end.bpmn20.xml")
18 | public class StartToEndProcess {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/sample/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=INFO, CA
2 |
3 | # ConsoleAppender
4 | log4j.appender.CA=org.apache.log4j.ConsoleAppender
5 | log4j.appender.CA.layout=org.apache.log4j.PatternLayout
6 | log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
--------------------------------------------------------------------------------
/sample/src/main/resources/processes/my-process.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
19 |
21 |
23 |
25 |
27 |
29 |
31 |
32 |
33 |
34 |
35 | PT10M
36 |
37 |
38 |
39 |
41 |
42 |
44 |
45 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/sample/src/main/resources/processes/proc-two-async-tasks.bpmn:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/sample/src/main/resources/processes/simple-service-task.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/sample/src/main/resources/processes/start-to-end.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/sample/src/main/resources/processes/vacationRequest.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 | ${employeeName} would like to take ${numberOfDays} day(s) of vacation (Motivation: ${vacationMotivation}).
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Your manager has disapproved your vacation request for ${numberOfDays} days.
22 | Reason: ${managerMotivation}
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/sample/src/test/java/org/flowable/sample/MyProcessTest.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import static org.xmlunit.assertj.XmlAssert.assertThat;
16 |
17 | import org.flowable.bpmn.converter.BpmnXMLConverter;
18 | import org.junit.jupiter.api.Test;
19 | import org.xmlunit.builder.Input;
20 |
21 | /**
22 | * @author Filip Hrisafov
23 | */
24 | class MyProcessTest {
25 |
26 | @Test
27 | void xmlMatches() {
28 | BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
29 | String myProcessXML = new String(xmlConverter.convertToXML(MyProcess.createMyProcessBpmnModel()));
30 | assertThat(myProcessXML)
31 | .and(Input.fromStream(getClass().getClassLoader().getResourceAsStream("processes/my-process.bpmn20.xml")))
32 | .areSimilar();
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/sample/src/test/java/org/flowable/sample/ProcTwoAsyncTasksTest.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import static org.xmlunit.assertj.XmlAssert.assertThat;
16 |
17 | import org.flowable.bpmn.converter.BpmnXMLConverter;
18 | import org.junit.jupiter.api.Test;
19 | import org.xmlunit.builder.Input;
20 |
21 | /**
22 | * @author Filip Hrisafov
23 | */
24 | class ProcTwoAsyncTasksTest {
25 |
26 | @Test
27 | void xmlMatches() {
28 | BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
29 | String myProcessXML = new String(xmlConverter.convertToXML(ProcTwoAsyncTasks.createProcTwoAsyncTasksBpmnModel()));
30 | assertThat(myProcessXML)
31 | .and(Input.fromStream(getClass().getClassLoader().getResourceAsStream("processes/proc-two-async-tasks.bpmn")))
32 | .areSimilar();
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/sample/src/test/java/org/flowable/sample/VacationRequestTest.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import static org.xmlunit.assertj.XmlAssert.assertThat;
16 |
17 | import org.flowable.bpmn.converter.BpmnXMLConverter;
18 | import org.junit.jupiter.api.Test;
19 | import org.xmlunit.builder.Input;
20 |
21 | /**
22 | * @author Filip Hrisafov
23 | */
24 | class VacationRequestTest {
25 |
26 | @Test
27 | void xmlMatches() {
28 | BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
29 | String vacationRequestXML = new String(xmlConverter.convertToXML(VacationRequest.createVacationRequestBpmnModel()));
30 | assertThat(vacationRequestXML)
31 | .and(Input.fromStream(getClass().getClassLoader().getResourceAsStream("processes/vacationRequest.bpmn20.xml")))
32 | .areSimilar();
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/spring-boot-sample/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | org.flowable.experimental
9 | flowable-serverless-parent
10 | 6.4.0-SNAPSHOT
11 |
12 |
13 | flowable-function-spring-boot-sample
14 |
15 |
16 |
17 | true
18 |
19 | 2.1.1.RELEASE
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-dependencies
27 | ${spring-boot.version}
28 | pom
29 | import
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.flowable.experimental
38 | flowable-processor-annotations
39 | 6.4.0-SNAPSHOT
40 |
41 |
42 | org.flowable.experimental
43 | flowable-processor
44 | 6.4.0-SNAPSHOT
45 |
46 |
47 | org.flowable.experimental
48 | flowable-serverless
49 | 6.4.0-SNAPSHOT
50 |
51 |
52 | org.flowable
53 | flowable-engine
54 | 6.4.0
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | org.springframework.cloud
66 | spring-cloud-starter-function-webflux
67 | 2.0.0.RELEASE
68 |
69 |
70 |
71 | org.hibernate.validator
72 | hibernate-validator
73 |
74 |
75 | org.springframework.boot
76 | spring-boot-starter-actuator
77 |
78 |
79 |
80 |
81 |
82 | org.springframework
83 | spring-context-indexer
84 | 5.1.3.RELEASE
85 |
86 |
87 |
88 |
89 | org.slf4j
90 | slf4j-log4j12
91 | 1.7.5
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | maven-jar-plugin
101 |
102 |
103 |
104 | ${start-class}
105 | true
106 |
107 |
108 |
109 |
110 |
111 | maven-war-plugin
112 |
113 |
114 |
115 | ${start-class}
116 | true
117 |
118 |
119 |
120 |
121 |
122 | org.springframework.boot
123 | spring-boot-maven-plugin
124 | ${spring-boot.version}
125 |
126 |
127 | repackage
128 |
129 | repackage
130 |
131 |
132 |
133 |
134 | ${start-class}
135 |
136 |
137 |
138 |
139 |
140 |
141 | org.springframework.boot
142 | spring-boot-maven-plugin
143 | 2.1.1.RELEASE
144 |
145 |
146 |
147 |
148 |
149 |
150 | repository.spring.milestone
151 | Spring Milestone Repository
152 | http://repo.spring.io/milestone
153 |
154 |
155 |
156 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/experiment/MyJavaDelegate.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package experiment;
14 |
15 | import java.util.concurrent.atomic.AtomicInteger;
16 |
17 | import org.flowable.engine.delegate.DelegateExecution;
18 | import org.flowable.engine.delegate.JavaDelegate;
19 |
20 | public class MyJavaDelegate implements JavaDelegate {
21 |
22 | public static final AtomicInteger COUNTER = new AtomicInteger(0);
23 |
24 | @Override
25 | public void execute(DelegateExecution execution) {
26 | COUNTER.incrementAndGet();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/org/flowable/sample/DemoApplication.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import java.util.function.Function;
16 |
17 | import org.flowable.engine.ProcessEngine;
18 | import org.flowable.serverless.ServerlessUtil;
19 | import org.springframework.boot.SpringBootConfiguration;
20 | import org.springframework.cloud.function.context.FunctionalSpringApplication;
21 |
22 | import experiment.MyJavaDelegate;
23 |
24 | /**
25 | * Build and run with
26 | * java -noverify -jar flowable-function-spring-boot-sample-6.4.0-SNAPSHOT.jar
27 | *
28 | * Try with
29 | * curl localhost:8084 -d test
30 | */
31 | @SpringBootConfiguration
32 | public class DemoApplication implements Function {
33 |
34 | public static ProcessEngine processEngine = ServerlessUtil.initializeProcessEngineForBpmnModel(commandContext -> SimpleServiceTask.createSimpleServiceTaskBpmnModel());;
35 |
36 | public static void main(String[] args) {
37 | FunctionalSpringApplication.run(DemoApplication.class, args);
38 | }
39 |
40 | @Override
41 | public String apply(String value) {
42 | String processInstanceId = processEngine.getRuntimeService().startProcessInstanceById(ServerlessUtil.PROCESS_DEFINITION_ID).getId();
43 | return "[Spring Cloud] - new process instance " + processInstanceId + " started. Number of delegation executions = " + MyJavaDelegate.COUNTER.get();
44 | }
45 |
46 | }
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/org/flowable/sample/SimpleServiceTaskProcess.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | @Bpmn(resource = "processes/simple-service-task.bpmn20.xml")
18 | public class SimpleServiceTaskProcess {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.jmx.enabled=false
2 |
3 | server.port=8084
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=INFO, CA
2 |
3 | # ConsoleAppender
4 | log4j.appender.CA=org.apache.log4j.ConsoleAppender
5 | log4j.appender.CA.layout=org.apache.log4j.PatternLayout
6 | log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/processes/simple-service-task.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | org.springframework.boot
9 | spring-boot-starter-parent
10 | 2.1.1.RELEASE
11 |
12 |
13 |
14 | org.flowable.experimental
15 | flowable-function-spring-cloud-aws-sample
16 | 1.0-SNAPSHOT
17 | jar
18 |
19 |
20 | true
21 | org.flowable.sample.DemoApplication
22 | 2.0.0.RELEASE
23 | 1.0.20.RELEASE
24 |
25 |
26 |
27 |
28 |
29 | org.springframework.cloud
30 | spring-cloud-function-dependencies
31 | ${spring-cloud-function.version}
32 | pom
33 | import
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | org.flowable.experimental
42 | flowable-processor-annotations
43 | 6.4.0-SNAPSHOT
44 |
45 |
46 | org.flowable.experimental
47 | flowable-processor
48 | 6.4.0-SNAPSHOT
49 |
50 |
51 | org.flowable.experimental
52 | flowable-serverless
53 | 6.4.0-SNAPSHOT
54 |
55 |
56 | org.flowable
57 | flowable-engine
58 | 6.4.0
59 |
60 |
61 |
62 | org.springframework.cloud
63 | spring-cloud-function-adapter-aws
64 | 2.0.0.RELEASE
65 |
66 |
67 | com.amazonaws
68 | aws-lambda-java-events
69 | 2.2.5
70 | provided
71 |
72 |
73 | com.amazonaws
74 | aws-lambda-java-core
75 | 1.2.0
76 | provided
77 |
78 |
79 |
80 | org.slf4j
81 | slf4j-log4j12
82 | 1.7.5
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | org.apache.maven.plugins
91 | maven-deploy-plugin
92 |
93 | true
94 |
95 |
96 |
97 | org.springframework.boot
98 | spring-boot-maven-plugin
99 |
100 |
101 | org.springframework.boot.experimental
102 | spring-boot-thin-layout
103 | ${wrapper.version}
104 |
105 |
106 |
107 |
108 | org.apache.maven.plugins
109 | maven-shade-plugin
110 |
111 | false
112 | true
113 | aws
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | spring-snapshots
122 | Spring Snapshots
123 | https://repo.spring.io/snapshot
124 |
125 | true
126 |
127 |
128 |
129 | spring-milestones
130 | Spring Milestones
131 | https://repo.spring.io/milestone
132 |
133 | false
134 |
135 |
136 |
137 |
138 |
139 | spring-snapshots
140 | Spring Snapshots
141 | https://repo.spring.io/snapshot
142 |
143 | true
144 |
145 |
146 |
147 | spring-milestones
148 | Spring Milestones
149 | https://repo.spring.io/milestone
150 |
151 | false
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/src/main/java/experiment/MyJavaDelegate.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package experiment;
14 |
15 | import java.util.concurrent.atomic.AtomicInteger;
16 |
17 | import org.flowable.engine.delegate.DelegateExecution;
18 | import org.flowable.engine.delegate.JavaDelegate;
19 |
20 | public class MyJavaDelegate implements JavaDelegate {
21 |
22 | public static final AtomicInteger COUNTER = new AtomicInteger(0);
23 |
24 | @Override
25 | public void execute(DelegateExecution execution) {
26 | COUNTER.incrementAndGet();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/src/main/java/org/flowable/sample/DemoApplication.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import java.util.function.Function;
16 |
17 | import org.flowable.engine.ProcessEngine;
18 | import org.flowable.serverless.ServerlessUtil;
19 | import org.springframework.boot.SpringApplication;
20 | import org.springframework.boot.autoconfigure.SpringBootApplication;
21 | import org.springframework.cloud.function.context.FunctionRegistration;
22 | import org.springframework.cloud.function.context.FunctionType;
23 | import org.springframework.context.ApplicationContextInitializer;
24 | import org.springframework.context.support.GenericApplicationContext;
25 |
26 | import experiment.MyJavaDelegate;
27 |
28 | /**
29 | * Build AWS specific jar (with aws suffix) using 'mvn clean package'
30 | */
31 | @SpringBootApplication
32 | public class DemoApplication implements ApplicationContextInitializer {
33 |
34 | public static ProcessEngine processEngine = ServerlessUtil.initializeProcessEngineForBpmnModel(commandContext -> SimpleServiceTask.createSimpleServiceTaskBpmnModel());
35 |
36 | public static void main(String[] args) {
37 | SpringApplication.run(DemoApplication.class, args);
38 | }
39 |
40 | public Function startProcess() {
41 | return value -> {
42 | String processInstanceId = processEngine.getRuntimeService().startProcessInstanceById(ServerlessUtil.PROCESS_DEFINITION_ID).getId();
43 | return "[Spring Cloud] - new process instance " + processInstanceId + " started. Number of delegation executions = " + MyJavaDelegate.COUNTER.get();
44 | };
45 | }
46 |
47 | @Override
48 | public void initialize(GenericApplicationContext genericApplicationContext) {
49 | genericApplicationContext.registerBean("startProcess", FunctionRegistration.class,
50 | () -> new FunctionRegistration>(startProcess())
51 | .type(FunctionType.from(FunctionInput.class).to(String.class).getType()));
52 | }
53 | }
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/src/main/java/org/flowable/sample/FunctionInput.java:
--------------------------------------------------------------------------------
1 | package org.flowable.sample;
2 |
3 | public class FunctionInput {
4 |
5 | private String a;
6 | private String b;
7 |
8 | public String getA() {
9 | return a;
10 | }
11 | public void setA(String a) {
12 | this.a = a;
13 | }
14 | public String getB() {
15 | return b;
16 | }
17 | public void setB(String b) {
18 | this.b = b;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/src/main/java/org/flowable/sample/SimpleServiceTaskProcess.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | @Bpmn(resource = "processes/simple-service-task.bpmn20.xml")
18 | public class SimpleServiceTaskProcess {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/src/main/java/org/flowable/sample/StartProcessRequestHandler.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.springframework.cloud.function.adapter.aws.SpringBootRequestHandler;
16 |
17 | public class StartProcessRequestHandler extends SpringBootRequestHandler {
18 |
19 | // Needed as MAIN_CLASS (see SpringFunctionInitializer) can't be found
20 | public StartProcessRequestHandler() {
21 | super(DemoApplication.class);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.jmx.enabled=false
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=INFO, CA
2 |
3 | # ConsoleAppender
4 | log4j.appender.CA=org.apache.log4j.ConsoleAppender
5 | log4j.appender.CA.layout=org.apache.log4j.PatternLayout
6 | log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
--------------------------------------------------------------------------------
/spring-cloud-aws-sample/src/main/resources/processes/simple-service-task.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spring-fu-sample/build-graal-image.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | rm flowablespringfu
4 |
5 | mvn clean package -Pgraal
6 | unzip target/flowable-function-spring-fu-sample*.jar -d target/flowable-function-spring-fu-sample
7 |
8 | native-image -H:IncludeResources='META-INF/.*.json|META-INF/spring.factories|org/springframework/boot/logging/.*'\
9 | --allow-incomplete-classpath\
10 | --delay-class-initialization-to-runtime=io.netty.handler.codec.http.HttpObjectEncoder,org.springframework.core.io.VfsUtils,org.springframework.format.support.DefaultFormattingConversionService\
11 | -H:ReflectionConfigurationFiles=graal/app.json,graal/boot.json,graal/framework.json,graal/log4j.json,graal/netty.json,graal/custom-reflect.json\
12 | -Dio.netty.noUnsafe=true -H:+ReportUnsupportedElementsAtRuntime\
13 | -Dfile.encoding=UTF-8\
14 | -cp ".:$(echo target/flowable-function-spring-fu-sample/BOOT-INF/lib/*.jar | tr ' ' ':')":target/flowable-function-spring-fu-sample/BOOT-INF/classes org.flowable.sample.SpringFuApplication
15 | mv org.flowable.sample.springfuapplication flowablespringfu
16 |
--------------------------------------------------------------------------------
/spring-fu-sample/graal/app.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "org.flowable.sample.ProcessService",
4 | "allDeclaredConstructors" : true,
5 | "allDeclaredMethods": true
6 | },
7 | {
8 | "name": "org.flowable.sample.ProcessHandler",
9 | "allDeclaredConstructors" : true,
10 | "allDeclaredMethods": true
11 | },
12 | {
13 | "name": "experiment.MyJavaDelegate",
14 | "allDeclaredConstructors" : true,
15 | "allDeclaredMethods": true
16 | }
17 | ]
--------------------------------------------------------------------------------
/spring-fu-sample/graal/boot.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "org.springframework.boot.env.PropertiesPropertySourceLoader",
4 | "allDeclaredConstructors": true
5 | },
6 | {
7 | "name": "org.springframework.boot.env.YamlPropertySourceLoader",
8 | "allDeclaredConstructors": true
9 | },
10 | {
11 | "name": "org.springframework.boot.context.event.EventPublishingRunListener",
12 | "allDeclaredConstructors": true
13 | },
14 | {
15 | "name": "org.springframework.boot.diagnostics.FailureAnalyzers",
16 | "allDeclaredConstructors": true
17 | },
18 | {
19 | "name": "org.springframework.boot.context.ConfigurationWarningsApplicationContextInitializer",
20 | "allDeclaredConstructors": true
21 | },
22 | {
23 | "name": "org.springframework.boot.context.ContextIdApplicationContextInitializer",
24 | "allDeclaredConstructors": true
25 | },
26 | {
27 | "name": "org.springframework.boot.context.config.DelegatingApplicationContextInitializer",
28 | "allDeclaredConstructors": true
29 | },
30 | {
31 | "name": "org.springframework.boot.ClearCachesApplicationListener",
32 | "allDeclaredConstructors": true
33 | },
34 | {
35 | "name": "org.springframework.boot.builder.ParentContextCloserApplicationListener",
36 | "allDeclaredConstructors": true
37 | },
38 | {
39 | "name": "org.springframework.boot.context.FileEncodingApplicationListener",
40 | "allDeclaredConstructors": true
41 | },
42 | {
43 | "name": "org.springframework.boot.context.config.AnsiOutputApplicationListener",
44 | "allDeclaredConstructors": true
45 | },
46 | {
47 | "name": "org.springframework.boot.context.config.ConfigFileApplicationListener",
48 | "allDeclaredConstructors": true
49 | },
50 | {
51 | "name": "org.springframework.boot.context.config.DelegatingApplicationListener",
52 | "allDeclaredConstructors": true
53 | },
54 | {
55 | "name": "org.springframework.boot.context.logging.ClasspathLoggingApplicationListener",
56 | "allDeclaredConstructors": true
57 | },
58 | {
59 | "name": "org.springframework.boot.context.logging.LoggingApplicationListener",
60 | "allDeclaredConstructors": true
61 | },
62 | {
63 | "name": "org.springframework.boot.cloud.CloudFoundryVcapEnvironmentPostProcessor",
64 | "allDeclaredConstructors": true
65 | },
66 | {
67 | "name": "org.springframework.boot.env.SpringApplicationJsonEnvironmentPostProcessor",
68 | "allDeclaredConstructors": true
69 | },
70 | {
71 | "name": "org.springframework.boot.env.SystemEnvironmentPropertySourceEnvironmentPostProcessor",
72 | "allDeclaredConstructors": true
73 | },
74 | {
75 | "name": "org.springframework.boot.diagnostics.analyzer.BeanCurrentlyInCreationFailureAnalyzer",
76 | "allDeclaredConstructors": true
77 | },
78 | {
79 | "name": "org.springframework.boot.diagnostics.analyzer.BeanDefinitionOverrideFailureAnalyzer",
80 | "allDeclaredConstructors": true
81 | },
82 | {
83 | "name": "org.springframework.boot.diagnostics.analyzer.BeanNotOfRequiredTypeFailureAnalyzer",
84 | "allDeclaredConstructors": true
85 | },
86 | {
87 | "name": "org.springframework.boot.diagnostics.analyzer.BindFailureAnalyzer",
88 | "allDeclaredConstructors": true
89 | },
90 | {
91 | "name": "org.springframework.boot.diagnostics.analyzer.BindValidationFailureAnalyzer",
92 | "allDeclaredConstructors": true
93 | },
94 | {
95 | "name": "org.springframework.boot.diagnostics.analyzer.UnboundConfigurationPropertyFailureAnalyzer",
96 | "allDeclaredConstructors": true
97 | },
98 | {
99 | "name": "org.springframework.boot.diagnostics.analyzer.ConnectorStartFailureAnalyzer",
100 | "allDeclaredConstructors": true
101 | },
102 | {
103 | "name": "org.springframework.boot.diagnostics.analyzer.NoSuchMethodFailureAnalyzer",
104 | "allDeclaredConstructors": true
105 | },
106 | {
107 | "name": "org.springframework.boot.diagnostics.analyzer.NoUniqueBeanDefinitionFailureAnalyzer",
108 | "allDeclaredConstructors": true
109 | },
110 | {
111 | "name": "org.springframework.boot.diagnostics.analyzer.PortInUseFailureAnalyzer",
112 | "allDeclaredConstructors": true
113 | },
114 | {
115 | "name": "org.springframework.boot.diagnostics.analyzer.ValidationExceptionFailureAnalyzer",
116 | "methods": [
117 | {
118 | "name": "",
119 | "parameterTypes": []
120 | }
121 | ]
122 | },
123 | {
124 | "name": "org.springframework.boot.diagnostics.analyzer.InvalidConfigurationPropertyNameFailureAnalyzer",
125 | "allDeclaredConstructors": true
126 | },
127 | {
128 | "name": "org.springframework.boot.diagnostics.analyzer.InvalidConfigurationPropertyValueFailureAnalyzer",
129 | "allDeclaredConstructors": true
130 | },
131 | {
132 | "name": "org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter",
133 | "allDeclaredConstructors": true
134 | },
135 | {
136 | "name": "org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer",
137 | "allDeclaredConstructors": true
138 | },
139 | {
140 | "name": "org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer$SharedMetadataReaderFactoryBean",
141 | "allDeclaredConstructors": true
142 | },
143 | {
144 | "name": "org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener",
145 | "allDeclaredConstructors": true
146 | },
147 | {
148 | "name": "org.springframework.boot.autoconfigure.BackgroundPreinitializer",
149 | "allDeclaredConstructors": true
150 | },
151 | {
152 | "name": "org.springframework.boot.autoconfigure.condition.ConditionEvaluationReportAutoConfigurationImportListener",
153 | "allDeclaredConstructors": true
154 | },
155 | {
156 | "name": "org.springframework.boot.autoconfigure.condition.OnClassCondition",
157 | "allDeclaredConstructors": true
158 | },
159 | {
160 | "name": "org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration",
161 | "allDeclaredConstructors": true
162 | },
163 | {
164 | "name": "org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration",
165 | "allDeclaredConstructors": true
166 | },
167 | {
168 | "name": "org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer",
169 | "allDeclaredConstructors": true
170 | },
171 | {
172 | "name": "org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener",
173 | "allDeclaredConstructors": true
174 | },
175 | {
176 | "name": "org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider",
177 | "allDeclaredConstructors": true
178 | },
179 | {
180 | "name": "org.springframework.boot.autoconfigure.mustache.MustacheTemplateAvailabilityProvider",
181 | "allDeclaredConstructors": true
182 | },
183 | {
184 | "name": "org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAvailabilityProvider",
185 | "allDeclaredConstructors": true
186 | },
187 | {
188 | "name": "org.springframework.boot.autoconfigure.thymeleaf.ThymeleafTemplateAvailabilityProvider",
189 | "allDeclaredConstructors": true
190 | },
191 | {
192 | "name": "org.springframework.boot.autoconfigure.web.servlet.JspTemplateAvailabilityProvider",
193 | "allDeclaredConstructors": true
194 | },
195 | {
196 | "name": "org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext",
197 | "methods": [
198 | { "name": "", "parameterTypes": [] }
199 | ]
200 | },
201 | {
202 | "name": "org.springframework.boot.logging.java.JavaLoggingSystem",
203 | "allDeclaredConstructors" : true,
204 | "allPublicConstructors" : true,
205 | "allPublicFields": true,
206 | "allPublicMethods": true,
207 | "allDeclaredMethods": true,
208 | "allDeclaredFields": true
209 | },
210 | {
211 | "name": "java.util.logging.ConsoleHandler",
212 | "allDeclaredConstructors" : true,
213 | "allPublicConstructors" : true,
214 | "allPublicFields": true,
215 | "allPublicMethods": true,
216 | "allDeclaredMethods": true,
217 | "allDeclaredFields": true
218 | },
219 | {
220 | "name": "java.util.logging.LogManager",
221 | "allDeclaredConstructors" : true,
222 | "allPublicConstructors" : true,
223 | "allPublicFields": true,
224 | "allPublicMethods": true,
225 | "allDeclaredMethods": true,
226 | "allDeclaredFields": true
227 | }
228 | ]
229 |
--------------------------------------------------------------------------------
/spring-fu-sample/graal/custom-reflect.json:
--------------------------------------------------------------------------------
1 | [ {
2 | "name" : "org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl",
3 | "allPublicMethods" : true,
4 | "allDeclaredConstructors" : true
5 | },
6 | {
7 | "name" : "java.util.HashMap",
8 | "allPublicMethods" : true,
9 | "allDeclaredConstructors" : true
10 | },
11 | {
12 | "name" : "org.flowable.common.engine.impl.de.odysseus.el.ExpressionFactoryImpl",
13 | "allPublicMethods" : true,
14 | "allDeclaredConstructors" : true
15 | }
16 | ]
--------------------------------------------------------------------------------
/spring-fu-sample/graal/framework.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "org.springframework.context.support.GenericApplicationContext",
4 | "methods": [
5 | { "name": "", "parameterTypes": [] }
6 | ]
7 | },
8 | {
9 | "name": "org.springframework.context.annotation.ConfigurationClassPostProcessor",
10 | "methods": [
11 | { "name": "", "parameterTypes": [] }
12 | ]
13 | },
14 | {
15 | "name": "org.springframework.http.codec.support.DefaultServerCodecConfigurer",
16 | "methods": [
17 | { "name": "", "parameterTypes": [] }
18 | ]
19 | }
20 | ]
--------------------------------------------------------------------------------
/spring-fu-sample/graal/log4j.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "org.apache.logging.log4j.message.ReusableMessageFactory",
4 | "methods": [
5 | { "name": "", "parameterTypes": [] }
6 | ]
7 | },
8 | {
9 | "name": "org.apache.logging.log4j.message.DefaultFlowMessageFactory",
10 | "methods": [
11 | { "name": "", "parameterTypes": [] }
12 | ]
13 | },
14 | {
15 | "name": "org.apache.logging.log4j.message.ParameterizedMessageFactory",
16 | "methods": [
17 | { "name": "", "parameterTypes": [] }
18 | ]
19 | }
20 | ]
--------------------------------------------------------------------------------
/spring-fu-sample/graal/netty.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "io.netty.channel.socket.nio.NioServerSocketChannel",
4 | "methods": [
5 | { "name": "", "parameterTypes": [] }
6 | ]
7 | },
8 | {
9 | "name": "io.netty.channel.socket.nio.NioSocketChannel",
10 | "methods": [
11 | { "name": "", "parameterTypes": [] }
12 | ]
13 | }
14 | ]
--------------------------------------------------------------------------------
/spring-fu-sample/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | org.flowable.experimental
9 | flowable-serverless-parent
10 | 6.4.0-SNAPSHOT
11 |
12 |
13 | flowable-function-spring-fu-sample
14 |
15 |
16 |
17 | true
18 |
19 | 2.1.1.RELEASE
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-dependencies
27 | ${spring-boot.version}
28 | pom
29 | import
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.flowable.experimental
38 | flowable-processor-annotations
39 | 6.4.0-SNAPSHOT
40 |
41 |
42 | org.flowable.experimental
43 | flowable-processor
44 | 6.4.0-SNAPSHOT
45 |
46 |
47 | org.flowable.experimental
48 | flowable-serverless
49 | 6.4.0-SNAPSHOT
50 |
51 |
52 | org.flowable
53 | flowable-engine
54 | 6.4.0
55 |
56 |
57 |
58 | org.springframework.fu
59 | spring-fu-jafu
60 | 0.0.5
61 |
62 |
63 |
64 | org.springframework.boot
65 | spring-boot-starter-webflux
66 |
67 |
68 | javax.annotation
69 | javax.annotation-api
70 |
71 |
72 | org.hibernate.validator
73 | hibernate-validator
74 |
75 |
76 |
77 |
78 | org.springframework.boot
79 | spring-boot-starter-mustache
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | maven-jar-plugin
89 |
90 |
91 |
92 | ${start-class}
93 | true
94 |
95 |
96 |
97 |
98 |
99 | maven-war-plugin
100 |
101 |
102 |
103 | ${start-class}
104 | true
105 |
106 |
107 |
108 |
109 |
110 | org.springframework.boot
111 | spring-boot-maven-plugin
112 | ${spring-boot.version}
113 |
114 |
115 | repackage
116 |
117 | repackage
118 |
119 |
120 |
121 |
122 | ${start-class}
123 |
124 |
125 |
126 |
127 |
128 |
129 | org.springframework.boot
130 | spring-boot-maven-plugin
131 | 2.1.1.RELEASE
132 |
133 |
134 |
135 |
136 |
137 |
138 | graal
139 |
140 |
141 | org.springframework.boot
142 | spring-boot-starter-webflux
143 |
144 |
145 | javax.annotation
146 | javax.annotation-api
147 |
148 |
149 | org.hibernate.validator
150 | hibernate-validator
151 |
152 |
153 | io.netty
154 | netty-transport-native-epoll
155 |
156 |
157 | io.netty
158 | netty-transport-native-unix-common
159 |
160 |
161 | io.netty
162 | netty-codec-http2
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 | repository.spring.milestone
174 | Spring Milestone Repository
175 | http://repo.spring.io/milestone
176 |
177 |
178 |
179 |
--------------------------------------------------------------------------------
/spring-fu-sample/src/main/java/experiment/MyJavaDelegate.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package experiment;
14 |
15 | import java.util.concurrent.atomic.AtomicInteger;
16 |
17 | import org.flowable.engine.delegate.DelegateExecution;
18 | import org.flowable.engine.delegate.JavaDelegate;
19 |
20 | public class MyJavaDelegate implements JavaDelegate {
21 |
22 | public static final AtomicInteger COUNTER = new AtomicInteger(0);
23 |
24 | @Override
25 | public void execute(DelegateExecution execution) {
26 | COUNTER.incrementAndGet();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/spring-fu-sample/src/main/java/org/flowable/sample/ProcessHandler.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import static org.springframework.web.reactive.function.server.ServerResponse.*;
16 |
17 | import reactor.core.publisher.Mono;
18 |
19 | import org.springframework.web.reactive.function.server.ServerRequest;
20 | import org.springframework.web.reactive.function.server.ServerResponse;
21 |
22 | public class ProcessHandler {
23 |
24 | private ProcessService processService;
25 |
26 | public ProcessHandler(ProcessService processService) {
27 | this.processService = processService;
28 | }
29 |
30 | public Mono startProcess(ServerRequest request) {
31 | return ok().syncBody(processService.startProcess());
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/spring-fu-sample/src/main/java/org/flowable/sample/ProcessService.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.flowable.serverless.ServerlessUtil;
16 |
17 | import experiment.MyJavaDelegate;
18 |
19 | public class ProcessService {
20 |
21 | public String startProcess() {
22 | String processInstanceId = SpringFuApplication.processEngine.getRuntimeService().startProcessInstanceById(ServerlessUtil.PROCESS_DEFINITION_ID).getId();
23 | return "[Spring Cloud] - new process instance " + processInstanceId + " started. Number of delegation executions = " + MyJavaDelegate.COUNTER.get();
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/spring-fu-sample/src/main/java/org/flowable/sample/SimpleServiceTaskProcess.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import org.flowable.experimental.bpmn.Bpmn;
16 |
17 | @Bpmn(resource = "processes/simple-service-task.bpmn20.xml")
18 | public class SimpleServiceTaskProcess {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/spring-fu-sample/src/main/java/org/flowable/sample/SpringFuApplication.java:
--------------------------------------------------------------------------------
1 | /* Licensed under the Apache License, Version 2.0 (the "License");
2 | * you may not use this file except in compliance with the License.
3 | * You may obtain a copy of the License at
4 | *
5 | * http://www.apache.org/licenses/LICENSE-2.0
6 | *
7 | * Unless required by applicable law or agreed to in writing, software
8 | * distributed under the License is distributed on an "AS IS" BASIS,
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | * See the License for the specific language governing permissions and
11 | * limitations under the License.
12 | */
13 | package org.flowable.sample;
14 |
15 | import static org.springframework.fu.jafu.Jafu.webApplication;
16 | import static org.springframework.fu.jafu.web.WebFluxServerDsl.server;
17 |
18 | import org.flowable.engine.ProcessEngine;
19 | import org.flowable.serverless.ServerlessUtil;
20 | import org.springframework.fu.jafu.JafuApplication;
21 |
22 | /**
23 | * Build with mvn clean package
24 | *
25 | * Try it out with
26 | *
27 | * curl localhost:8080/process
28 | */
29 | public class SpringFuApplication {
30 |
31 | public static ProcessEngine processEngine =
32 | ServerlessUtil.initializeProcessEngineForBpmnModel(commandContext -> org.flowable.sample.SimpleServiceTask.createSimpleServiceTaskBpmnModel());
33 |
34 | public static JafuApplication app = webApplication(application -> {
35 |
36 | application.beans(beanDefinition -> {
37 | beanDefinition.bean(ProcessHandler.class);
38 | beanDefinition.bean(ProcessService.class);
39 | });
40 |
41 | application.enable(server(server -> {
42 |
43 | server.port(8080);
44 |
45 | server.router(r -> {
46 | ProcessHandler handler = server.ref(ProcessHandler.class);
47 | r.GET("/process", handler::startProcess);
48 | });
49 |
50 | server.codecs(codec -> { codec.string(); codec.jackson(); });
51 | }));
52 | });
53 |
54 | public static void main(String[] args) {
55 | app.run(args);
56 | }
57 |
58 | }
--------------------------------------------------------------------------------
/spring-fu-sample/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.jmx.enabled=false
2 | spring.main.banner-mode=off
--------------------------------------------------------------------------------
/spring-fu-sample/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=INFO, CA
2 |
3 | # ConsoleAppender
4 | log4j.appender.CA=org.apache.log4j.ConsoleAppender
5 | log4j.appender.CA.layout=org.apache.log4j.PatternLayout
6 | log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
--------------------------------------------------------------------------------
/spring-fu-sample/src/main/resources/processes/simple-service-task.bpmn20.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------