ITÊýÂë ¹ºÎï ÍøÖ· Í·Ìõ Èí¼þ ÈÕÀú ÔĶÁ ͼÊé¹Ý
TxTС˵ÔĶÁÆ÷
¡ýÓïÒôÔĶÁ,С˵ÏÂÔØ,¹ÅµäÎÄѧ¡ý
ͼƬÅúÁ¿ÏÂÔØÆ÷
¡ýÅúÁ¿ÏÂÔØͼƬ,ÃÀŮͼ¿â¡ý
ͼƬ×Ô¶¯²¥·ÅÆ÷
¡ýͼƬ×Ô¶¯²¥·ÅÆ÷¡ý
Ò»¼üÇå³ýÀ¬»ø
¡ýÇáÇáÒ»µã,Çå³ýϵͳÀ¬»ø¡ý
¿ª·¢: C++֪ʶ¿â Java֪ʶ¿â JavaScript Python PHP֪ʶ¿â È˹¤ÖÇÄÜ Çø¿éÁ´ ´óÊý¾Ý Òƶ¯¿ª·¢ ǶÈëʽ ¿ª·¢¹¤¾ß Êý¾Ý½á¹¹ÓëËã·¨ ¿ª·¢²âÊÔ ÓÎÏ·¿ª·¢ ÍøÂçЭÒé ϵͳÔËά
½Ì³Ì: HTML½Ì³Ì CSS½Ì³Ì JavaScript½Ì³Ì GoÓïÑÔ½Ì³Ì JQuery½Ì³Ì VUE½Ì³Ì VUE3½Ì³Ì Bootstrap½Ì³Ì SQLÊý¾Ý¿â½Ì³Ì CÓïÑÔ½Ì³Ì C++½Ì³Ì Java½Ì³Ì Python½Ì³Ì Python3½Ì³Ì C#½Ì³Ì
ÊýÂë: µçÄÔ ±Ê¼Ç±¾ ÏÔ¿¨ ÏÔʾÆ÷ ¹Ì̬ӲÅÌ Ó²ÅÌ ¶ú»ú ÊÖ»ú iphone vivo oppo СÃ× »ªÎª µ¥·´ ×°»ú ͼÀ­¶¡
 
   -> Java֪ʶ¿â -> camundaʹÓÃÖ¸ÄÏ -> ÕýÎÄÔĶÁ

[Java֪ʶ¿â]camundaʹÓÃÖ¸ÄÏ

²Î¿¼:Camunda ¿ìËÙÈëÃÅ¡¢Camunda SpringBootÓë½ø½×ÄÚÈÝ¡¢camundaÖÐÎÄÕ¾¡¢camunda¹Ù·½Ó¢ÎÄÎĵµ

ʹÓÃÁ÷³Ì

1¡¢ÏÂÔغͰ²×°

ÔÚ¼ÆËã»úÉÏ°²×°Camunda BPMƽ̨ºÍCamunda Modeler(ÓÃÓڱ༭Á÷³Ìͼ¼°ÆäËûÄ£ÐÍ)¡£

Camunda ModelerÏÂÔصØÖ· https://camunda.com/download/modeler/ ¡£

2¡¢±à¼­Á÷³Ì

н¨BPMNÁ÷³Ì ¡ª¡ª> ±à¼­ ¡ª¡ª> ÅäÖÃÁ÷³Ì²ÎÊý ¡ª¡ª> ±£´æÉú³É .bpmn Îļþ ¡ª¡ª> ÓÃjava»ònodeʵÏÖÈÎÎñ

Service Task(·þÎñÈÎÎñ) , ·þÎñÀàÐÍÓкܶàÖ´Ðеķ½·¨,±ÈÈç¡°external(Íⲿ)¡±ÈÎÎñģʽ ¡£

User Task(È˹¤ÈÎÎñ)

ÅäÖÃÍⲿÈÎÎñ:

image-20210526063609416

ÅäÖÃÁ÷³Ì²ÎÊý:

image-20210526063821870

±àдÖ÷ÀàʵÏÖÒµÎñÂß¼­,´úÂë´óÖÂÈçÏÂ:

import java.util.logging.Logger;
import java.awt.Desktop;
import java.net.URI;

import org.camunda.bpm.client.ExternalTaskClient;

public class ChargeCardWorker {
  private final static Logger LOGGER = Logger.getLogger(ChargeCardWorker.class.getName());

  public static void main(String[] args) {
    ExternalTaskClient client = ExternalTaskClient.create()
        .baseUrl("http://localhost:8080/engine-rest")
        .asyncResponseTimeout(10000) // ³¤ÂÖѯ³¬Ê±Ê±¼ä
        .build();

    // ¶©ÔÄÖ¸¶¨µÄÍⲿÈÎÎñ,charge-card¶ÔӦˢ¿¨¸¶¿îµÄÍⲿÈÎÎñid
    client.subscribe("charge-card")
        .lockDuration(1000) // ĬÈÏËø¶¨Ê±¼äΪ20Ãë,ÕâÀïÐÞ¸ÄΪ1Ãë
        .handler((externalTask, externalTaskService) -> {
          // ½«ÄúµÄÒµÎñÂß¼­Ð´ÔÚÕâ

          // »ñÈ¡Á÷³Ì±äÁ¿
          String item = (String) externalTask.getVariable("item");
          Long amount = (Long) externalTask.getVariable("amount");

          LOGGER.info("Charging credit card with an amount of '" + amount + "'€ for the item '" + item + "'...");

          try {
              Desktop.getDesktop().browse(new URI("https://docs.camunda.org/get-started/quick-start/complete"));
          } catch (Exception e) {
              e.printStackTrace();
          }

          // Íê³ÉÈÎÎñ
          externalTaskService.complete(externalTask);
        })
        .open();
  }
}
  • ´úÂëÖеÄ"http://localhost:8080/engine-rest"¶ÔÓ¦ÏÂÃ沿ÊðÁ÷³ÌÖеÄREST Endpoint¡£(×¢Òâµã)
3¡¢²¿ÊðÁ÷³Ì

½«²¿ÊðÁ÷³Ìµ½Á÷³ÌÒýÇæ,È»ºó·¢ÆðÁ÷³Ì,¼ì²éÁ÷³ÌÊÇ·ñ·¢Æð³É¹¦ ¡£

ʹÓà Camunda Modeler ²¿ÊðÁ÷³Ì

µã»÷¹¤¾ßÀ¸ÖеIJ¿Êð°´Å¥¿ÉÒÔ½«µ±Ç°Á÷³Ì²¿Êðµ½Á÷³ÌÒýÇæ,µã»÷²¿Êð°´Å¥,ÊäÈëDeployment Name Ϊ ¡°Payment¡± ,ÊäÈëÏ·½REST Endpoint Ϊhttp://localhost:8080/engine-rest ,È»ºóµã»÷ÓÒϽÇDeploy²¿Êð:

image-20210527063619110

ʹÓÃCockpit²é¿´²¿Êð½á¹û
´´½¨Á÷³ÌʵÀý(·¢ÆðÁ÷³Ì)

ʹÓÃRest API·¢ÆðÁ÷³Ì,ËùÒÔÐèÒªÒ»¸ö½Ó¿Ú²âÊÔ¹¤¾ß(ÀýÈç:Postman),»òÕßÒ²¿ÉÒÔʹÓõçÄÔ×Ô´øµÄcurl

a) curl

ÔÚÃüÁîÐÐÖÐÖ´ÐÐ

curl -H "Content-Type: application/json" -X POST -d '{"variables": {"amount": {"value":555,"type":"long"}, "item": {"value":"item-xyz"} } }' http://localhost:8080/engine-rest/process-definition/key/payment-retrieval/start
  • "http://localhost:8080/engine-rest"¶ÔÓ¦´úÂëÖеÄbaseUrl;
  • process-definition
  • payment-retrieval¶ÔÓ¦¡°¸¶¿îÁ÷³Ì¡±id

Èç¹ûÄÜ¿´µ½³É¹¦µÄ·µ»Ø½á¹û,ÔòÁ÷³Ì·¢Æð³É¹¦¡£

b)Postman

ÔÚurlÖÐÊäÈë http://localhost:8080/engine-rest/process-definition/key/payment-retrieval/start

ģʽѡÔñPOST

µã»÷Body,Ñ¡Ôñraw,²¢ÔÚÓÒÃæÑ¡Ôñapplication/json

È»ºóÊäÈëBodyÄÚÈÝ:

{
	"variables": {
		"amount": {
			"value":555,
			"type":"long"
		},
		"item": {
			"value": "item-xyz"
		}
	}
}

±à¼­Íê³Éºó,½á¹ûÕâÑù:

image-20210526075056144

µã»÷ Send ·¢ËÍÇëÇó

Èç¹ûÄÜ¿´µ½³É¹¦µÄ·µ»Ø½á¹û,ÔòÁ÷³Ì·¢Æð³É¹¦

4¡¢È˹¤ÈÎÎñ

Á˽⽫È˹¤ÈÎÎñ¼¯³Éµ½Á÷³ÌÖеĻù´¡ÖªÊ¶,ÒÔ¼°ÈçºÎʹÓÃCamunda¹¹½¨±íµ¥¡£

Ìí¼ÓÈ˹¤ÈÎÎñ½Úµã¡°Åú×¼¸¶¿î¡±:

image-20210527061148133

ÅäÖÃÈ˹¤ÈÎÎñ±íµ¥:

µã»÷¡°Åú×¼¸¶¿î½Úµã¡±,ÔÚÓÒ²àµÄÊôÐÔÃæ°åÖеã»÷Forms(±íµ¥)Ñ¡Ï,µã»÷ÏÂÃæµÄ¼ÓºÅ,Ìí¼Ó3¸öÊôÐÔ:

image-20210527061619655

ÊôÐÔ1:

  • ID: amount
  • Type: long
  • Label: ½ð¶î

image-20210527062004660

ÊôÐÔ2:

  • ID: item
  • Type: string
  • Label: ÏîÄ¿

image-20210527062029129

ÊôÐÔ3:

  • ID: approved
  • Type: boolean
  • Label: ÊÇ·ñͬÒâ?

image-20210527062104122

·¢ÆðÁ÷³Ì:

²¿ÊðÁ÷³Ìºó,´ò¿ªÈÎÎñÁбí(http://localhost:8080/camunda/app/tasklist/),ʹÓà demo / demo µÇ¼

µã»÷ÓÒÉÏ½ÇµÄ Start process ,ÔÚµ¯³öµÄ¶Ô»°¿òÖÐÑ¡Ôñ¡°¸¶¿îÁ÷³Ì¡±

image-20210527062701901

Õâʱ»áµ¯³ö±à¼­Á÷³Ì±äÁ¿µÄ¶Ô»°¿ò,¿ÉÒÔͨ¹ýµã»÷ Add a variable °´Å¥Ìí¼Ó±äÁ¿,Õâ´ÎÎÒÃÇÏȲ»Ìí¼Ó,Ö±½Óµã»÷ÓÒÏÂ½Ç Start Æô¶¯Á÷³Ì(×¢Òâµã)

image-20210527063004938

Õâʱ,ÔÚÈÎÎñÁбíÓ¦¸Ã¾ÍÄÜ¿´µ½¸Õ´´½¨µÄÈ˹¤ÈÎÎñÁË,Èç¹ûûÓпÉÒÔÊÖ¶¯Ë¢ÐÂÒ»ÏÂ

²¿·ÖÓû§ÕâÀï¿´²»µ½,¿ÉÄÜÊÇ All Tasks ¹ýÂËÆ÷ûÓÐ×Ô¶¯Ìí¼Ó,×ó²àÏÔʾΪ:

image-20210527070001945

Õâʱµã»÷ Add a simple filter ¼´¿É

Ñ¡ÔñÕâ¸öÈÎÎñÏî,ÔÚÓÒ²à¿ÉÒÔ¿´µ½±íµ¥

image-20210527065738905

µã»÷ Diagram Ñ¡Ï,¿ÉÒÔ¿´µ½¸ßÁÁµÄ½Úµã¾ÍÊǵ±Ç°½øÐÐÖеĽڵã

image-20210527065754734

5¡¢¶¯Ì¬ÐÔ(Íø¹Ø)

Á˽âÈçºÎͨ¹ýÏòÁ÷³ÌÌí¼ÓÍø¹ØÀ´Ê¹Á÷³Ì¸ü¾ß¶¯Ì¬ÐÔ¡£

ÅÅËûÍø¹Ø(Exclusive Gateways)

Ìí¼ÓÍø¹Ø(ÁâÐÎ)²¢½øÐÐÅäÖÃ:

image-20210528065311137

±ÈÈç,

Ñ¡Ôñ¡°<1000¡±µÄÁ¬Ïß,´ò¿ªÊôÐÔÃæ°å,Ñ¡Ôñ¡°Condition Type¡±Îª¡°Expression¡±,ÕâÀïÎÒÃÇʹÓÃJAVAͳһ±í´ïʽÓïÑÔ±àдÌõ¼þ,ÕâÀïÒª×öµÄÊÇÔÚ½ð¶îСÓÚ1000ʱֱ½ÓË¢¿¨¸¶¿î,ÔòÊäÈë±í´ïʽ ${amount<1000}

image-20210528070903818

´ò¿ªÈÎÎñÁбí(http://localhost:8080/camunda/app/tasklist/),ʹÓà demo / demo µÇ¼

µã»÷ÓÒÉÏ½ÇµÄ Start process ,ÔÚµ¯³öµÄ¶Ô»°¿òÖÐÑ¡Ôñ¡°¸¶¿îÁ÷³Ì¡±

ÔÚÉÏÒ»ÕÂÖÐ,ÎÒÃÇÖ±½Óµã»÷ Start,µ«Õâ´ÎÎÒÃÇÒªÔö¼Ó¼¸¸ö±äÁ¿À´²âÊÔ¶¯Ì¬µÄÁ÷³Ì(¹Ø¼üµã)

image-20210528072028596

ÊÔןü¸Ä amount µÄÖµ,²é¿´¶ÔÁ÷³ÌÖ´ÐÐ˳ÐòµÄÓ°Ïì¡£

6¡¢¾ö²ß×Ô¶¯»¯

Á˽âÈçºÎÔÚÁ÷³ÌÖм¯³ÉDMN¾ö²ß±í¡£

camunda+springboot

ÔÚÁ÷³ÌÖе÷Óà JAVA Class

ͨ¹ýformÑ¡ÏÌí¼Ó±íµ¥ ¡ª¡ª> Ìí¼Óservice taskµ½Á÷³ÌÖÐ ¡ª¡ª> ±àдjavaÀà ¡ª¡ª> ÅäÖÃservice task ¡ª¡ª> Æô¶¯ÐÂÁ÷³Ì

image-20210530100557989

webÓ¦ÓóÌÐò (Tasklist, Cockpit, Admin, Rest Api ½Ó¿Ú )

  • REST API REST APIÔÊÐíÄãʹÓÃÔ¶³ÌÓ¦ÓûòJavaScriptÓ¦ÓõÄÁ÷³ÌÒýÇæ¡£ (×¢Òâ:REST APIµÄÎĵµÒѳÉΪ×Ô¼ºµÄÎĵµ¡£)
  • Camunda Tasklist ÓÃÓÚÈ˹¤Á÷¹ÜÀíºÍÓû§ÈÎÎñµÄWebÓ¦ÓÃ,ÔÊÐíÁ÷³Ì²ÎÓëÕß¼ì²éÆ乤×÷Á÷ÈÎÎñ²¢µ¼º½µ½ÈÎÎñ±íµ¥,ÒÔ±ãÔÚÈÎÎñÉϹ¤×÷²¢ÌṩÊý¾ÝÊäÈë¡£
  • Camunda Cockpit ÓÃÓÚ¹ý³Ì¼àÊӺͲÙ×÷µÄWebÓ¦ÓÃ,ÔÊÐíÄãËÑË÷Á÷³ÌʵÀý,¼ì²éÆä״̬²¢ÐÞ¸´Ë𻵵ÄʵÀý¡£
  • Camunda Admin ÔÊÐíÄã¹ÜÀíÓû§,×éºÍÊÚȨµÄWebÓ¦Óá£
  Java֪ʶ¿â ×îÐÂÎÄÕÂ
¼ÆËã¾àÀë´º½Ú»¹Óж೤ʱ¼ä
ϵͳ¿ª·¢ÏµÁÐ Ö®WebService£¨spring¿ò¼Ü+ma
springBoot+Cache(×Ô¶¨ÒåÓÐЧʱ¼äÅäÖÃ)
SpringBootÕûºÏmybatisʵÏÖÔöɾ¸Ä²é¡¢·ÖÒ³²é
spring½Ì³Ì
SpringBoot+VueʵÏÖÃÀʳ½»Á÷ÍøÕ¾µÄÉè¼ÆÓëʵ
ÐéÄâ»úÄÚ´æ½á¹¹ÒÔ¼°ÐéÄâ»úÖÐÏú»ÙºÍн¨¶ÔÏó
SpringMVC---Ô­Àí
СÀîͬѧ: JavaÈçºÎ°´¶à¸ö×ֶηÖ×é
´òӡƱ¾Ý--java
ÉÏһƪÎÄÕ      ÏÂһƪÎÄÕ      ²é¿´ËùÓÐÎÄÕÂ
¼Ó:2022-03-10 22:17:51  ¸ü:2022-03-10 22:19:35 
 
¿ª·¢: C++֪ʶ¿â Java֪ʶ¿â JavaScript Python PHP֪ʶ¿â È˹¤ÖÇÄÜ Çø¿éÁ´ ´óÊý¾Ý Òƶ¯¿ª·¢ ǶÈëʽ ¿ª·¢¹¤¾ß Êý¾Ý½á¹¹ÓëËã·¨ ¿ª·¢²âÊÔ ÓÎÏ·¿ª·¢ ÍøÂçЭÒé ϵͳÔËά
½Ì³Ì: HTML½Ì³Ì CSS½Ì³Ì JavaScript½Ì³Ì GoÓïÑÔ½Ì³Ì JQuery½Ì³Ì VUE½Ì³Ì VUE3½Ì³Ì Bootstrap½Ì³Ì SQLÊý¾Ý¿â½Ì³Ì CÓïÑÔ½Ì³Ì C++½Ì³Ì Java½Ì³Ì Python½Ì³Ì Python3½Ì³Ì C#½Ì³Ì
ÊýÂë: µçÄÔ ±Ê¼Ç±¾ ÏÔ¿¨ ÏÔʾÆ÷ ¹Ì̬ӲÅÌ Ó²ÅÌ ¶ú»ú ÊÖ»ú iphone vivo oppo СÃ× »ªÎª µ¥·´ ×°»ú ͼÀ­¶¡

360ͼÊé¹Ý ¹ºÎï Èý·á¿Æ¼¼ ÔĶÁÍø ÈÕÀú ÍòÄêÀú 2024Äê11ÈÕÀú -2024/11/24 11:49:55-

ͼƬ×Ô¶¯²¥·ÅÆ÷
¡ýͼƬ×Ô¶¯²¥·ÅÆ÷¡ý
TxTС˵ÔĶÁÆ÷
¡ýÓïÒôÔĶÁ,С˵ÏÂÔØ,¹ÅµäÎÄѧ¡ý
Ò»¼üÇå³ýÀ¬»ø
¡ýÇáÇáÒ»µã,Çå³ýϵͳÀ¬»ø¡ý
ͼƬÅúÁ¿ÏÂÔØÆ÷
¡ýÅúÁ¿ÏÂÔØͼƬ,ÃÀŮͼ¿â¡ý
  ÍøÕ¾ÁªÏµ: qq:121756557 email:121756557@qq.com  ITÊýÂë