Visual flow arrangement method for e-commerce marketing
By constructing a visual process orchestration method in the e-commerce marketing system, decoupling state transition rules and performing dynamic matching based on event logs, the problems of low efficiency in state calculation, rigid rule matching, and difficulty in state traceability in existing technologies are solved, achieving efficient and accurate process orchestration and data consistency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU SEVEN THINGS ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-21
AI Technical Summary
Existing process orchestration architectures suffer from poor real-time performance in state calculations, low efficiency in event-response matching, insufficient scalability, and difficulties in state migration tracing and consistency assurance in e-commerce marketing scenarios, especially in high-concurrency scenarios.
By visually configuring state transition rules in the form of definition files, and dynamically matching rules based on real-time consumer status and behavioral events, a decoupled data processing architecture centered on state transition rule sets and event logs is constructed to achieve real-time, accurate rule matching and state updates in high-concurrency scenarios.
It enhances the flexibility and scalability of rule management, ensures rapid and accurate state deduction and marketing action execution in high-concurrency scenarios, provides a complete record of state changes across the entire chain, and guarantees the consistency and traceability of data processing.
Smart Images

Figure CN121900769A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer software technology, and in particular to state management and business process automation technology in distributed systems. Specifically, it relates to a visual process orchestration method for e-commerce marketing. Background Technology
[0002] In event-driven interactive systems (such as e-commerce marketing backends), it is typically necessary to dynamically update the state of a user (or consumer) and trigger subsequent operations based on a series of behavioral events. To achieve automation, existing technologies generally employ process orchestration engines or state machines, which build business process templates through predefined state nodes and transition paths. Such architectures usually organize data and execution logic around "process instances".
[0003] However, applying such a general architecture directly to the scenario of dynamic management of user journey states exposes the following technical shortcomings: 1) Poor real-time performance and high overhead in state calculation: The current state of a user needs to be derived in real time from its historical event sequence. Existing technologies often hardcode the state judgment logic into process nodes or require traversing instances for derivation, which becomes a performance bottleneck under high concurrency. 2) Low efficiency and insufficient scalability in event-response matching: Business rules are actually a set of "responding to specific events and executing corresponding actions under specific states". Existing technologies embed the rules in the topology of the flowchart, and each event trigger needs to "find a path" in the complex process network, making it difficult to support the rapid matching and querying of massive and volatile rules. 3) Difficulty in state transition tracing and consistency assurance: State transition history is critical data. Existing technologies often treat it as an auxiliary record of process instances, lacking a unified, structured event log centered on the user, making state rollback, fault recovery, and data consistency maintenance complex. Ultimately, the aforementioned shortcomings stem from the architectural limitations of existing technologies: they fail to effectively decouple, index, organize, and efficiently query the core data types such as "user identifiers," "behavioral event streams," "configurable rule sets," and "calculated states."
[0004] Therefore, the technical problem to be solved by this invention is: in an event-driven interactive data processing system, how to overcome the limitations of the existing process orchestration architecture and realize a method that can efficiently and accurately match the dynamically calculated user state and real-time behavioral events with rules, and ensure the traceability of the entire link state and data consistency. Summary of the Invention
[0005] To address the aforementioned technical issues, this invention provides a visual process orchestration method for e-commerce marketing. By visually configuring and persisting state transition rules in the form of definition files, and dynamically matching rules based on real-time consumer status and behavioral events, it can achieve real-time, accurate, and scalable marketing action triggering and status updates in high-concurrency scenarios.
[0006] To address the aforementioned technical problems, this invention provides the following technical solution: a visual workflow orchestration method for e-commerce marketing, applied to a server, the method comprising: receiving a state flow definition file, the state flow definition file defining state transition rules based on user journey states and user behavior events, wherein the user journey states represent the staged identity or rights status of a consumer in a marketing activity, and the user behavior events represent interactive operation events triggered by the consumer; parsing the state flow definition file to generate and store a set of state transition rules with a consumer identifier and a marketing activity identifier as a joint index; and obtaining the consumer's user behavior events, the user behavior events including the consumer identifier and the marketing activity identifier. The system identifies the consumer and the marketing campaign. Based on these identifiers, it retrieves the consumer's historical state transition event sequence from the event log and calculates the consumer's current user journey state under the current marketing campaign. Using the marketing campaign identifier, it obtains the corresponding state transition rule set and performs a matching query on the state transition rule set, taking the current user journey state and the user behavior event as input. If a matching state transition rule is found, it executes the marketing action command defined by the matching state transition rule and generates a corresponding new state transition event, which is persisted to the event log to update the consumer's user journey state.
[0007] As a preferred embodiment of the visual process orchestration method for e-commerce marketing described in this invention, the method further includes periodically performing the following processing: based on the incremental log or pre-write log of the event log, identifying new or modified state transition events since the previous maintenance cycle, and extracting their associated {consumer identifier, marketing activity identifier} combinations to form a set to be verified; for each combination in the set to be verified, reading its currently stored state snapshot A from the distributed state cache, and re-executing the deterministic state advancement steps according to all events of the combination after the version number of state snapshot A, calculating the theoretically latest state snapshot B, and comparing the current user journey state and version number in state snapshot A and state snapshot B; if state snapshot A and state snapshot B are inconsistent, updating the record in the distributed state cache to state snapshot B, and generating a cache repair log; scanning the distributed state cache, and lazily deleting or marking records whose last update time is earlier than the start time of the current marketing activity cycle or whose associated marketing activity has ended.
[0008] The beneficial effects of this invention are as follows: By constructing a decoupled data processing architecture centered on a state transition rule set and event logs, the method effectively solves the problems of low state calculation efficiency, rigid rule matching, and difficult state tracing faced by existing process orchestration technologies in e-commerce marketing scenarios. Specifically: First, by parsing the state flow definition file and generating a state transition rule set with consumer identifiers and marketing activity identifiers as joint indexes, configurable, structured storage, and fast retrieval of rules are achieved. This decouples business rules from complex process topologies, transforming them into a data set that can be efficiently queried by identifier, thereby greatly improving the flexibility of rule management and system scalability, supporting the real-time maintenance and matching of massive, dynamic rules. Second, by obtaining historical state transition event sequences from event logs based on consumer identifiers and marketing activity identifiers, and dynamically calculating the current user journey state accordingly, real-time and accurate state derivation is achieved. This avoids the performance overhead caused by hard-coding state logic or traversing process instances in traditional solutions, enabling the rapid and accurate determination of each consumer's current context in high-concurrency scenarios, providing reliable input for subsequent rule matching. Third, by using the current user journey state and user behavior events as input, matching queries are performed in the state transition rule set, and marketing action commands defined by the matching rules are executed, event-driven precise response and automated execution are achieved. This transforms each consumer interaction into an efficient data query and action trigger, significantly reducing system response latency. Furthermore, the execution of marketing actions strictly depends on real-time calculated states and events, ensuring the accuracy and consistency of business logic. Fourth, by generating new state transition events after executing marketing actions and persisting them to the event log, a complete and structured record of end-to-end state transitions is achieved. This establishes a consumer-centric, traceable, and auditable state evolution timeline, providing a solid data foundation for fault recovery, behavior analysis, and system monitoring, and ensuring data processing consistency in a distributed environment. In summary, this invention, through the synergistic effect of the above technical means, forms an efficient, accurate, and traceable process orchestration mechanism, significantly improving the processing performance, maintainability, and business adaptability of e-commerce marketing systems in high-concurrency, multi-event scenarios. Attached Figure Description
[0009] Figure 1 A flowchart illustrating the visual process orchestration method for e-commerce marketing provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the first sub-process of the visual process orchestration method for e-commerce marketing provided in an embodiment of the present invention. Detailed Implementation
[0010] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0011] The visual process orchestration method for e-commerce marketing provided in this invention can be a real-time data processing and rule execution engine hosted by a server or distributed system. It can directly drive e-commerce marketing applications across multiple dimensions, including but not limited to: First, in a member lifecycle management platform, by analyzing user journey states and user behavior events, it automatically triggers tiered benefits distribution, level upgrades / downgrades, and personalized marketing outreach, achieving refined operations; Second, in social e-commerce and distribution systems, by matching state transition rules in real time, it automatically processes events such as sharing, order completion, and team upgrades, accurately calculates and distributes rewards, and supports the reliable operation of complex distribution models. This invention solves the technical challenges of dynamic state calculation and efficient rule matching in high-concurrency scenarios, providing scalable core technical support for process automation and personalization in the e-commerce marketing and interactive service fields.
[0012] The following detailed description of some embodiments of the present invention is provided in conjunction with the accompanying drawings.
[0013] Example 1, please refer to Figure 1 , Figure 1 This is a flowchart illustrating a visual workflow orchestration method for e-commerce marketing provided in an embodiment of the present invention. Figure 1 As shown, in this embodiment, the method is applied to a server, and the method includes, but is not limited to, the following steps S11-S16: S11: Receive a state flow definition file, which defines state transition rules based on user journey state and user behavior events. The user journey state represents the staged identity or rights status of a consumer in a marketing activity, and the user behavior event represents an interactive operation event triggered by the consumer.
[0014] A state flow definition file is a structured data file generated through a graphical interface (such as a drag-and-drop designer). It typically uses standard data exchange formats such as JSON, YAML, or XML. This file defines a logical set of state transition rules and is a "programmatic rule set description" that the system can recognize, parse, and execute.
[0015] A state transition rule represents an instruction with explicit computer-executable logic. Its core structure is: "When a consumer is in user journey state X, if a user behavior event Y occurs, execute the marketing action command Z and update the consumer's state to user journey state X'." For example, a state transition rule can be defined as: "When a consumer's state is 'new registered member,' if the 'complete first payment' event occurs, execute the 'issue discount coupon' command and update the state to 'basic active member.'" Different state transition rules are linked through user journey states and user behavior events, forming a navigable directed graph or rule network.
[0016] In data processing, user journey state represents dynamic attribute labels maintained and calculated by the system, characterizing a consumer's status within a specific marketing campaign context. It signifies the consumer's stage-specific identity or rights status during the marketing activity and is a state node in a finite state machine. For example, in e-commerce marketing scenarios, user journey state can represent attribute labels including, but not limited to, "Not Participating," "Under Qualification Review," "Pending Payment," "VIP Member," and "Choked." User journey state is derived in real-time from the consumer's historical state transition event sequence (recorded in an event log) through pre-defined computational logic (such as a state machine model) and is one of the key inputs for the system's rule matching.
[0017] User behavior events represent structured data messages triggered by consumers' interactive operations (such as clicking, browsing, placing orders, sharing, and paying) on the front-end interface (such as Apps, mini-programs, and web pages) and transmitted to the server via the network. Each user behavior event includes necessary metadata such as event type, consumer identifier, marketing campaign identifier, and timestamp.
[0018] The specific implementation is as follows: First, the system provides a web-based management console (frontend). Operations personnel can drag and drop elements and configure user journey states, user behavior events, and state transition rules through a visual graphical interface (such as status nodes, event connections, and action configuration panels). After configuration, the frontend submits the generated state flow definition file (e.g., in JSON format) to the backend server via HTTP / HTTPS protocol. Second, after receiving the state flow definition file, the server first performs JSON schema validation to ensure the data structure conforms to predefined specifications. Then, it calls a rule parsing engine (e.g., a custom parser built based on tools like ANTLR) to convert the rule descriptions in the JSON into internally executable state transition rule objects. The parsed state transition rule set is then persistently stored in a high-performance database (e.g., Redis) or an index database (e.g., Elasticsearch), using the user journey state and user behavior event type as the composite key. For example, the generated index structure might be: {"state: new registered member, event: complete_first_payment": [rule ID_123]}.
[0019] First, by defining a state flow definition file, the business logic and system execution logic are decoupled. This allows marketing rules to be updated simply by updating the state flow definition file, greatly improving the system's maintainability and scalability. Second, by parsing the state flow definition file and generating a state transition rule set with user journey states and user behavior events as a joint index, the rule matching problem is transformed from a complex process topology traversal to an efficient data index query problem. When high-concurrency traffic surges, the system does not need to traverse a large flowchart for each event; it can directly locate candidate rules through two key-value queries (user journey state, user behavior event). This solves the problem of low rule matching efficiency at the architectural level and provides a fundamental performance foundation for the system to support high-concurrency scenarios.
[0020] S12: Parse the state flow definition file, generate and store a set of state transition rules with consumer identifier and marketing campaign identifier as joint indexes.
[0021] The specific implementation is as follows: After receiving the state flow definition file, the server first calls the rule parsing engine built on a deterministic algorithm (such as an LL(1) grammar parser or a JSON Schema validator) to perform syntax and structure checks on the state flow definition file to ensure that it conforms to the predefined format specifications and prevent system runtime exceptions caused by misconfiguration. Subsequently, the rule parsing engine traverses each state transition rule in the file and performs the following core operations: 1) Extract the conditions (user journey state, user behavior event) and actions (marketing action command, target user journey state) defined in the state transition rules and instantiate them into rule objects in memory. 2) Generate a storage index key for each state transition rule. The key improvement lies in the composition of the index key: the index key is prefixed with the consumer identifier and the marketing campaign identifier (or partition key), forming a composite key structure such as campaign_id:consumer_id:current_state:event_type. The reason for choosing this specific index structure is: A) In distributed storage systems (such as Redis Cluster or sharded MySQL), the marketing campaign identifier, as a first-level partition key, can physically or logically shard a large amount of rule data according to the marketing campaign dimension. When processing a specific user behavior event, the system can first quickly locate the corresponding data shard based on the "marketing campaign identifier" carried in the event, greatly narrowing the global search scope. B) The "consumer identifier," as a second-level index dimension, enables the system to support fine-grained rule configuration and querying based on individual consumers in the future (e.g., setting exclusive rules for corresponding VIP users), while also providing support for data isolation in multi-consumer scenarios at the data structure level. 3) Persist the state transition rules and their generated composite index keys to a high-performance key-value store database (such as Redis) or search engine (such as Elasticsearch).
[0022] For example, suppose an "e-commerce marketing promotion" campaign (campaign_id: T_Y) defines a state transition rule: when a consumer's state is "items in shopping cart" and the "browse coupons" event occurs, execute the action "pop up a notification of available coupons". Based on this, after parsing, the state transition rule is instantiated as an object containing fields such as current_state = "items in shopping cart", trigger_event = "browse coupons", and action = "pop up a notification of available coupons". For consumer "User A" (consumer_id: U001), the system may generate an index key: T_Y:U001:items in shopping cart:browse coupons. For all consumers under this campaign, the index keys of all similar rules begin with T_Y:, and the serialized rule object of the state transition rule is stored in Redis using the above index key.
[0023] First, by designing a storage scheme with "consumer identifier and marketing campaign identifier as a combined index," the rule matching problem is transformed from a graph traversal problem facing complex flowcharts to a precise key-value query or efficient range query problem facing structured databases. When a massive influx of concurrent events occurs, the system does not need to traverse the entire rule set or complex process network. It directly calculates the index key through "marketing campaign identifier and consumer identifier (or combined with current state and event type)" in the event, achieving rule location with an approximate O(1) time complexity in distributed storage, greatly improving rule retrieval efficiency. This fundamentally solves the retrieval performance bottlenecks in the aforementioned technical problems, namely "rigid and poorly scalable event-rule matching mechanism" and "low efficiency of state calculation and rule retrieval." Second, this index structure supports atomic operations and transaction management at the marketing campaign or consumer level, facilitating batch updates of rules, canary releases, and strict isolation of data between different activities. This ensures the consistency and isolation of data operations and improves the system's "state traceability and consistency maintenance" capabilities. Therefore, the customized data indexing and storage architecture designed for the specific needs of high concurrency and real-time response in e-commerce marketing significantly optimizes the core data processing performance of the system, which is a key technical link supporting the efficient and accurate process orchestration of the entire invention.
[0024] S13: Obtain consumer user behavior events, which include consumer identifiers and marketing campaign identifiers.
[0025] The specific implementation is as follows: First, the system receives user behavior events reported in real time from various distributed front-end applications (such as apps, mini-programs, and web pages) via an event collection service deployed on the server, through a load balancer and network interfaces (such as TCP-based RPC services or HTTP / HTTPS API endpoints). Each event reporting request must contain at least a structured JSON data body encapsulated by the front-end SDK, which must include consumer identifiers (such as user ID and device ID), marketing campaign identifiers, and fields such as event type, timestamp, and context parameters. Second, after receiving the event, the system extracts the core consumer identifier and marketing campaign identifier from the event object. Finally, based on the marketing campaign identifier, the event is published to the corresponding topic's event log through a high-performance message queue (such as Kafka or RocketMQ) for asynchronous distribution. This achieves traffic smoothing, decoupling of event collection and core processing logic, and supports physical or logical isolation of event streams from different marketing campaigns, facilitating independent scaling and fault isolation.
[0026] S14: Based on the consumer identifier and the marketing campaign identifier, obtain the consumer's historical state transition event sequence from the event log, and calculate the consumer's current user journey state under the current marketing campaign based on the historical state transition event sequence.
[0027] A historical state transition event sequence represents a set of state transition events related to a specific consumer under a given marketing campaign, strictly ordered by timestamps. Each state transition event records complete information about the consumer's transition from one user journey state to another at a certain point in time. Its data structure includes: event ID, consumer identifier, marketing campaign identifier, user journey state before migration (from_state), type of triggered user behavior event, user journey state after migration (to_state), and timestamp. The historical state transition event sequence objectively and completely depicts the dynamic behavioral trajectory and state evolution process of the consumer in the marketing campaign, and serves as the data basis for calculating their current user journey state.
[0028] The specific implementation is as follows: First, the system receives user behavior events from the message queue and constructs a composite query key (e.g., campaign_id:consumer_id) based on the consumer identifier and marketing campaign identifier. Then, it initiates a query to the event log database. The event log typically uses a database optimized for time-series data and range queries (e.g., Cassandra, TimescaleDB, or Elasticsearch). Its data is indexed by (marketing campaign identifier, consumer identifier, timestamp) to achieve efficient retrieval of the corresponding consumer under the corresponding marketing campaign, either in reverse or sequential order. Second, the system executes the query, for example: SELECT * FROM event_log WHERE campaign_id = ? AND consumer_id = ? ORDER BY timestamp DESC LIMIT N, to obtain the historical state migration event sequence of the consumer's most recent N times (or within a specific time window). Third, load the state machine definition corresponding to the marketing campaign identifier (compiled from the state flow definition file, clearly defining all valid user journey states and transition conditions), and starting from the latest state transition event, sequentially (or in reverse order) traverse the obtained historical state transition event sequence. Based on the logic in the state machine definition, perform state deduction, starting from the system's preset initial state (e.g., "not participating") or the previous known valid to_state, sequentially applying each state transition event in the historical state transition event sequence. If the historical state transition event sequence is continuous and complete, the to_state of the last state transition event is the current user journey state. If the historical state transition event sequence is interrupted or conflicts with the state machine logic (e.g., a state transition event indicates a transition from user journey state A to B, but the currently deduced user journey state is not A), perform calculations according to the preset conflict resolution strategy (e.g., rollback to the previous consistent state, or triggering an exception handling process) to ensure the determinism and rationality of the state calculation results.
[0029] For example, for consumer "U123" in the "new_year_2025" activity, assume that its event log already contains the following historical state transition event sequence arranged in chronological order: {..., from_state: “Not participating”, event: “enter_campaign_page”, to_state: “Browsing”, ts: T1} {..., from_state: “Browsing”, event: “add_to_cart”, to_state: “Items in shopping cart”, ts: T2} {..., from_state: “Items in shopping cart”, event: “coupon_click”, to_state: “Coupon claimed”, ts: T3} (This is generated after handling the event newly generated in step S13) When a new user behavior event (such as "submitting an order") arrives, triggering calculation S14: First, the system queries the most recent events of consumer "U123" under the activity "new_year_2025" to obtain the above sequence (assuming N=10, including these 3 events). Second, the state machine of the "new_year_2025" activity is loaded, starting from the initial state "not participating". Event 1 is applied, changing the state to "browsing"; event 2 is applied, changing the state to "items in shopping cart"; event 3 is applied, changing the state to "coupon claimed". Therefore, the calculated current user journey state is "coupon claimed", which will serve as the input for subsequent rule matching.
[0030] This step, through efficient querying based on a composite index of (marketing campaign identifier, consumer identifier, timestamp), quickly retrieves relevant historical state migration event sequences, solving the technical challenge of efficiently extracting individual behavioral trajectories from massive log data.
[0031] S15: Based on the marketing campaign identifier, obtain the corresponding state transition rule set, and perform a matching query in the state transition rule set using the current user journey state and the user behavior event as input.
[0032] The goal of this step is to accurately and efficiently locate and trigger corresponding business actions from a predefined rule base based on the real-time calculated consumer context (current user journey state) and immediate behavior (user behavior events). This process transforms the execution of business logic from traditional "process traversal" to efficient "data querying," which is key to solving the efficiency and scalability issues of event-rule matching. Its specific implementation is as follows: First, the system retrieves the state transition rule set corresponding to the marketing activity from a distributed cache or rule database based on the marketing activity identifier carried in the user behavior event. Second, using the current user journey state and the type of the user behavior event (event_type) as the core matching conditions, a query key is constructed. This constructed query key (e.g., a string formatted as current_state:event_type) is directly used as the key to initiate a precise GET query to a high-performance key-value database (such as Redis) storing the state transition rule set. Third, the database returns the query results. If a matching key is found, the corresponding state transition rule object is returned (which contains the marketing action command to be executed and the target user journey state). If not found, it means that no business action is defined in the current "state-event" combination. The system can record this situation and end the process, or handle it according to the predefined default strategy.
[0033] This step transforms the logical judgment problem of business rule matching into the problem of efficient reading of pre-built index data structure by using a matching mechanism that "combines user journey status and user behavior event type into precise keys for direct query". This achieves a qualitative leap in rule matching performance and enables key decision-making steps for real-time and accurate process orchestration in high-concurrency environments.
[0034] S16: If a matching state transition rule is found, execute the marketing action command defined by the matching state transition rule, generate a corresponding new state transition event and persist it to the event log to update the consumer's user journey state.
[0035] Marketing action commands represent specific atomic operation instructions that can be recognized and executed by downstream business systems. They are structured data objects whose core definition specifies the type of operation to be performed and its parameters, rather than being a natural language description. For example, their structure might be: {"action_type": "SEND_COUPON", "params": {"coupon_id": "COUPON_100", "channel": "PUSH"}} or {"action_type": "UPDATE_USER_LEVEL", "params": {"new_level": "VIP"}}. Marketing action commands serve as the technical interface connecting the process orchestration system with specific business execution systems (such as coupon systems, membership systems, and message push systems), ensuring that decisions are accurately and automatically translated into actual system operations.
[0036] The specific implementation is as follows: First, after the system queries a matching state transition rule, it parses the marketing action command in the state transition rule and publishes the marketing action command as a message to the corresponding topic in a highly reliable message queue (such as Kafka or RocketMQ), driving the frontend to execute the marketing action. Second, after successfully publishing the marketing action command to the message queue, the system needs to record the information of this state transition and generate a new state transition event. This new state transition event records the complete context of this state transition, and its data structure includes: a unique event ID, a consumer identifier, a marketing activity identifier, the user journey state before the transition (i.e., the current user journey state calculated by S14), the type of the triggered user behavior event, the matching rule ID, the user journey state after the transition (i.e., the next_state defined in the rule), and a timestamp. This new state transition event is synchronously or asynchronously persisted to the event log database. This step is the core of solving the state traceability problem. It ensures that every valid state transition has one and only one corresponding, tamper-proof event record, providing a unique and reliable data source for subsequent state recalculation, business auditing, and user behavior analysis. Therefore, by imposing the mandatory technical constraint of "synchronously generating and persisting new state transition events after the execution of an action", an immutable event tracing mechanism is established to achieve the traceability and consistency of the user journey state, and completely solve the problem of "difficulty in state tracing and consistency maintenance" pointed out in the background technology. This invention, through its embodiment, constructs a decoupled data processing architecture centered on a set of state transition rules and event logs. This effectively addresses the problems of low state calculation efficiency, rigid rule matching, and difficulty in state traceability faced by existing process orchestration technologies in e-commerce marketing scenarios. By establishing a consumer-centric, traceable, and auditable state evolution timeline, it provides a solid data foundation for fault recovery, behavior analysis, and system monitoring, ensuring data processing consistency in a distributed environment. In summary, through the synergistic effect of the aforementioned technical means, this invention forms an efficient, accurate, and traceable process orchestration mechanism, significantly improving the processing performance, maintainability, and business adaptability of e-commerce marketing systems in high-concurrency, multi-event scenarios.
[0037] In one embodiment, please refer to Figure 2 , Figure 2 This is a schematic diagram of the first sub-process of the visual process orchestration method for e-commerce marketing provided in an embodiment of the present invention. Figure 2 As shown, in this embodiment, the current user journey state of the consumer under the current marketing campaign is calculated based on the historical state transition event sequence, including: S21: Based on the historical state transition event sequence, perform total order sorting based on the vector clock tags recorded in the historical state transition events to determine the global order of concurrent events generated across different servers or threads, and generate a globally ordered event stream. Each state transition event is labeled with a vector clock tag by the processing server based on the logical clock protocol when it is persisted to the event log. S22: In the globally ordered event stream, detect whether there are concurrent conflict events that target the same combination of {consumer identifier, marketing campaign identifier}, have the same vector clock logical time, but differ from at least one of the source user journey state and the triggering event; S23: If the concurrent conflict events exist, select a state transition event as a valid event from the concurrent conflict events according to the preset conflict resolution strategy. The conflict resolution strategy includes at least one of the following: a priority strategy based on event type, a deterministic selection strategy based on server ID, and a comparison strategy based on event-attached weights. S24: The effective event flow after total ordering and conflict resolution is provided as input to a deterministic finite state machine, wherein the state set of the finite state machine is all possible user journey states defined by the current marketing campaign, and the transition rules are defined by the state transition rule set. S25: Process each valid event sequentially, take the previous user journey state as the current state, drive the finite state machine, deterministically transition to the target user journey state corresponding to the valid event as defined by the state transition rule set, and update the target user journey state to the current user journey state; S26: After each state transition, generate and store the latest state snapshot corresponding to the {consumer identifier, marketing campaign identifier} combination. The latest state snapshot includes: the current user journey state, the state version number that monotonically increases with the state transition, and the vector clock tag of the valid event corresponding to this state transition. Synchronously update the latest state snapshot to the distributed state cache. S27: When it is necessary to obtain the current user journey state of the consumer, read the current user journey state from the latest state snapshot in the distributed state cache and return it.
[0038] Vector clock tags represent a logical timestamp technique used in distributed systems to order state transition events. In this embodiment of the invention, each state transition event is tagged with a vector clock tag by the server node processing it according to the vector clock protocol upon generation. The vector clock tag is a vector (array), where each element corresponds to a server node participating in the processing. When a node generates or forwards a state transition event, it increments its own component in the vector and appends the updated complete vector as a tag to the state transition event. By comparing the vector clock tags of two state transition events, it can be determined whether a Happened-before causal relationship exists between them, or whether they are concurrent events whose order cannot be determined. This embodiment of the invention utilizes this mechanism to determine the logical order of state transition events from different servers, thereby providing a logically consistent sequence of event inputs for subsequent deterministic state calculations.
[0039] A deterministic finite state machine represents an abstract computational model in which the set of states, the set of input events, and the state transition function are all deterministic and finite. In this embodiment of the invention, the set of states consists of all user journey states defined by the marketing campaign, the input events are ordered and conflict-resolved state transition events, and the transition function is precisely defined by the set of state transition rules. For the same initial state and sequence of input events, this state machine will necessarily produce the same final state, which is the technical basis for achieving determinism and reproducibility of state computation results.
[0040] The state version number, which monotonically increases with state transitions, represents an integer counter bound to the consumer identifier and the marketing campaign identifier. Each time the state of this combination is successfully updated (i.e., a state transition is performed), the counter is strictly incremented by 1. This state version number is stored as part of the latest state snapshot. Its technical significance is: 1) to provide a unique, fully ordered identifier for each state update, facilitating quick identification of the latest state; 2) in concurrent write scenarios, it can serve as a version condition for optimistic locking, preventing state overwriting and loss due to concurrent read and write operations, and is a key mechanism for achieving state update consistency in a distributed environment.
[0041] The specific implementation is as follows: S21. Based on the consumer identifier and marketing activity identifier, query the relevant historical state transition event sequence. Then, call the total order sorting algorithm (such as an algorithm that extends the partial order relationship based on vector clocks to total order) to compare and sort the vector clock labels of all historical state transition events, generating a globally ordered event stream. S22-S23. In the globally ordered event stream, the system detects whether there are concurrent conflict events (such as events where vector clocks cannot be compared sequentially, logically occur simultaneously, but attempt to change the same consumer's same activity state). After a conflict is detected, the system selects one as a valid event according to a preset, deterministic conflict resolution strategy (such as prioritizing the transition from the "payment successful" event rather than the "browse" event, or prioritizing the event generated by the node with the smaller server ID), discarding or marking other conflict events. Introducing a deterministic conflict resolution strategy is to ensure that all nodes reach a consensus on "which event will ultimately take effect" when concurrent writes are unavoidable, which is a necessary means to achieve final state consistency. S24-S25: The sorted and resolved valid event stream is sequentially input into a deterministic finite state machine. Starting from a known initial user journey state (or the previous user journey state read from the cache), the finite state machine deterministically calculates the next user journey state for each valid event according to the transition function defined in the state transition rule set. Based on this, the target user journey state is determined and updated to the current user journey state. S26-S27: After each state transition, the system generates a latest state snapshot containing the latest user journey state, an incremented state version number, and a vector clock tag of the triggering event, and writes it to a distributed state cache (such as Redis). Subsequent requests to obtain the current user journey state can directly read the user journey state from the cache in this latest state snapshot, without needing to repeat the complete replay calculation starting from the event log. The technical reasons for introducing snapshots and version numbers are: 1) removing state replay calculations from the "read path" and providing sub-millisecond-level user journey state readings through caching to achieve performance optimization and solve the performance bottleneck under high-concurrency queries; 2) version numbers provide a lightweight concurrency control mechanism to prevent data inconsistency between the cache and event logs.
[0042] For example, suppose consumer "U123" receives user behavior event A (from "Browsing" to "Items in Cart", vector clock {S1:2, S2:0}) and user behavior event B (from "Browsing" to "Coupon Claimed", vector clock {S1:1, S2:1}) almost simultaneously from two different server instances during the activity "new_year_2025". Based on this, the following processing is performed: S21, compare the vector clocks; {S1:2, S2:0} and {S1:1, S2:1} cannot be compared (concurrency). The sorting algorithm may determine that user behavior event A comes first based on components and rules (such as secondary sorting by server ID and logical time). S22-S23, the system detects that both user behavior event A and user behavior event B attempt to transition from the "Browsing" state, but their target states are different, constituting a concurrency conflict. According to the preset "event type priority strategy" (such as "Add to Cart" having higher priority than "Claim Coupon"), user behavior event A is selected as the valid event. S24-S25: The state machine starts from "Browsing," applies user behavior event A, and transitions to "Items in shopping cart." User behavior event B is ignored. S26-S27: A snapshot {state: "Items in shopping cart," version: 5, vector_clock: {S1:2, S2:0}} is generated and stored in Redis. The next query will directly return "Items in shopping cart."
[0043] This embodiment constructs a highly reliable, consistent, and efficient state computation system in a distributed, high-concurrency environment. By attaching vector clock labels to state transition events and performing total order sorting, the logical causal order of state transition events is reconstructed in a distributed environment lacking a global clock. This provides a deterministic input foundation for user journey state computation and solves the technical challenge of unpredictable state computation caused by out-of-order state transition events. Its core creative contribution lies in combining a "deterministic conflict resolution strategy" with a "deterministic finite state machine," ensuring that even in the face of concurrent state modification requests, the state evolution path of the entire system is unique and predictable. The direct technical effects are: First, all server nodes, as long as they process the same event logs with the same sorting and resolution rules, will eventually calculate the exact same current user journey state, achieving strong eventual consistency and completely eliminating the inconsistency problem common in distributed state computation. Second, since the entire computation process is deterministic, any abnormal state can be reproduced and diagnosed by replaying the event logs and strictly following the sorting, resolution, and state machine rules, improving the robustness and debuggability of user journey state computation, and greatly enhancing the observability and maintainability of the system. Third, by employing a latest state snapshot caching mechanism, the complex user journey state replay calculation is transformed into a simple cache read, optimizing read performance and ensuring read-write consistency. This significantly reduces the latency of user journey state queries and improves system throughput. Furthermore, by combining state version numbers, a lightweight coordination mechanism is provided for concurrent user journey state updates, ensuring logical consistency between cached data and the event log source. In summary, this embodiment, by introducing a complete distributed collaborative computing, conflict resolution, and cache optimization solution, not only solves the state calculation problem under the basic process but also enhances it into a state management service capable of meeting the stringent requirements of distributed production environments, possessing industrial-grade consistency, reliability, and performance.
[0044] In one embodiment, the method further includes periodically performing the following processing: based on the incremental log or pre-write log of the event log, identifying new or modified state transition events since the previous maintenance cycle, and extracting their associated {consumer identifier, marketing campaign identifier} combinations to form a set to be verified; for each combination in the set to be verified, reading its currently stored state snapshot A from the distributed state cache, re-executing the deterministic state advancement steps based on all events of the combination after the version number of state snapshot A, calculating the theoretically latest state snapshot B, and comparing the current user journey state and version number in state snapshot A and state snapshot B; if state snapshot A and state snapshot B are inconsistent, updating the record in the distributed state cache to state snapshot B, and generating a cache repair log; scanning the distributed state cache, and lazily deleting or marking records whose last update time is earlier than the start time of the current marketing campaign cycle or whose associated marketing campaign has ended.
[0045] Lazy deletion refers to a data cleanup strategy. Its core characteristic is that physical deletion is not performed immediately, but rather logical marking or deferred processing is performed first. In this embodiment of the invention, it specifically means that when the system identifies that a record in the distributed state cache has expired (such as an associated marketing campaign that has ended) or has not been updated for a long time, it does not immediately remove it from the cache storage. Instead, it first marks it as "expired" or "pending deletion". The actual physical deletion operation may be performed asynchronously in subsequent garbage collection cycles, when cache space is insufficient, or during low-load periods. This strategy avoids the instantaneous impact on system performance caused by performing intensive deletion operations during peak business periods, and improves the stability of the overall system throughput.
[0046] The specific implementation is as follows: The system deploys an independent cache maintenance service, which triggers the following process at a fixed period (e.g., every 5 minutes): First, the cache maintenance service identifies all new or modified state transition events since the last maintenance cycle based on incremental logs provided by the event log (e.g., MySQL's binlog or CDC stream) or write log (WAL), and extracts the associated {consumer identifier, marketing campaign identifier} combinations from them. All such combinations are collected to form a set to be verified. Secondly, for each combination in the set to be verified, the cache maintenance service performs a deterministic replay calculation: read the currently stored state snapshot A of the combination from the distributed state cache; based on the combination, query the event log to obtain all state transition events that have occurred since the version number of state snapshot A; starting from the state of state snapshot A, recalculate a theoretically latest state snapshot B according to the aforementioned deterministic state advancement steps (including total order sorting based on vector clocks, conflict resolution, and state machine driving); compare the current user journey state and version number in state snapshot A and state snapshot B; if they are inconsistent, atomically update the record in the distributed state cache to state snapshot B and generate a cache repair log. This asynchronous verification mechanism is a key improvement of this embodiment of the invention. It establishes a self-correcting feedback loop based on event sourcing theory. Even if the cache and the source of the event log are temporarily inconsistent due to extreme situations (such as a brief cache service failure or network partition), this mechanism can automatically detect and repair the inconsistency, ensuring eventual strong consistency of the cache. Finally, the cache maintenance service simultaneously scans the distributed state cache, identifying two types of records that can be cleaned up: first, records whose last update time is earlier than the start time of the current marketing campaign period (indicating that the consumer has no activity during this period); and second, records whose associated marketing campaigns have clearly ended. For these records, the maintenance service does not delete them immediately, but performs lazy deletion, for example, moving them to a separate "expiration zone" or setting a very short time-to-live (TTL) for them, allowing the cache system's own eviction mechanism to clean them up later. The technical reason for using lazy deletion instead of synchronous deletion is to avoid generating intensive deletion I / O operations during the maintenance cycle, preventing latency spikes on the normal read and write requests of the cache service, and ensuring the performance stability of the main business threads.
[0047] This embodiment constructs a high-performance state caching system that is self-maintaining and self-repairing. By building a set of data to be verified based on incremental logs, the scope of cache consistency maintenance is focused from all data to data that has changed, greatly reducing the computational and I / O overhead of maintenance operations. This enables high-frequency, near real-time verification, thereby significantly improving the timeliness of detecting and repairing cache data inconsistencies. Its core creative contribution lies in the introduction of an "asynchronous replay verification and repair mechanism based on event log sources." The direct technical effects are: First, by periodically performing deterministic replay comparisons between cached state snapshots and the event log—the sole source of fact—it can detect and automatically correct dirty cache data caused by any reason, achieving an eventual strong consistency guarantee for cached data. This allows the system to safely rely on the high-performance cache to serve the vast majority of read requests without worrying about long-term data inconsistency risks, fundamentally solving the data consistency problem brought about by the introduction of caching. Second, this mechanism enables the system to automatically recover from soft state errors (cache data errors), reducing reliance on manual intervention, improving the system's self-healing ability and reliability, and enhancing its robustness and availability. Finally, by managing expired caches through a lazy deletion strategy, we can avoid the long-term occupation of valuable memory resources by useless data (preventing memory leaks) and avoid the service performance fluctuations that may be caused by synchronous batch deletion operations, thus ensuring the smooth and efficient operation of the cache service and the entire process orchestration system that depends on it.
[0048] In one embodiment, performing a matching query on the set of state transition rules includes: constructing an in-memory hash index with {marketing campaign identifier, source user journey state, user behavior event} as the composite key, wherein the source user journey state is the migration start state defined by the state transition rule; assembling the current user journey state and the user behavior event, combined with the marketing campaign identifier, into a composite key to be queried; and performing a key-value query operation based on the in-memory hash index. If a match is found, the matching state transition rule and its defined target user journey state and marketing action command are returned; if no match is found, a null value is returned.
[0049] The specific implementation is as follows: First, iterate through the parsed set of state transition rules for the corresponding marketing campaign identifier. For each state transition rule, extract its three key attributes: the marketing campaign identifier to which the state transition rule belongs, the defined transition start state (i.e., the source user journey state), and the type of the user behavior event being responded to. Concatenate or encode these three attributes in a fixed order to generate a string (or integer hash value) as the composite key. Then, use the complete state transition rule (including the target user journey state and the marketing action command) as the rule value. Initialize a hash table (e.g., Java's HashMap or Go's map) in the server's memory (e.g., JVM Heap or Go Runtime Memory), and batch insert the above composite key-rule value mapping relationship into this hash table, thereby constructing a memory hash index with {marketing campaign identifier, source user journey state, user behavior event} as the composite key. Preloading all rules into memory means that each rule match does not require access to external storage, completely eliminating I / O latency. This is the fundamental guarantee for achieving sub-millisecond, deterministic responses. The creativity of choosing {marketing campaign identifier, source user journey state, user action event} as the composite key lies in its precise correspondence to all the necessary and sufficient conditions for rule matching, ensuring that a single query can uniquely determine a rule (if it exists), avoiding secondary queries or complex calculations. Secondly, when a matching query needs to be executed (i.e., in step S15), the current user journey state, user action event, and marketing campaign identifier in the context are assembled into the composite key to be queried, following the exact same format and order as when the index was built. The underlying hash table's get or lookup method is then called, using the composite key as a parameter to perform a key-value query operation. If a match is found, the hash table returns the state transition rule associated with that key within a constant time, and then extracts the target user journey state and marketing action command from it, completing the match. If a match is not found, the hash table returns a null or None value, indicating that no rule is defined for the current "state-event" combination, and the process can proceed according to a preset strategy (such as ending or switching to default processing).
[0050] This invention, through pre-building a hash index in memory, places rule data in the fastest storage medium and utilizes a hash table data structure to physically prepare for high-speed queries. Its core creative contribution lies in designing a precise indexing strategy using "{marketing campaign identifier, source user journey state, user behavior event} as a composite key" and fully embedding it within an in-memory hash table. The direct technical effects are: First, each matching operation is simplified to a single memory address calculation and access, reducing its time complexity and actual latency to constant levels and extremely low levels. This solves the problem of "rigid and poorly scalable event-rule matching mechanisms" in existing technologies, ensuring that even under high concurrency pressure of millions of events per second, rule matching will not become a bottleneck for system throughput, significantly improving the overall processing capacity and response speed of the system. Second, since it is entirely based on memory operations, without any network or disk I / O uncertainty, the return time of the matching result is predictable and stable, ensuring absolute determinism and low latency in the matching process. This provides a reliable low-latency baseline for the entire workflow orchestration system, which is crucial for marketing interaction experiences requiring real-time feedback. Third, since it does not rely on external rule databases or complex rule engines, it reduces the external dependencies and potential failure points of the system. The maintenance and query logic of the in-memory hash table is simple and robust, which improves the reliability and maintainability of the rule matching module itself.
[0051] In one embodiment, executing a marketing action command defined by a matching state transition rule and generating a corresponding new state transition event includes: parsing the marketing action command, identifying its command type and associated marketing resource identifier and personalized parameter template; obtaining the consumer's dynamic feature vector from a user feature database based on the consumer identifier, the dynamic feature vector including real-time behavioral preferences, cumulative spending amount, and current time period activity; inputting the dynamic feature vector and the personalized parameter template into a preset resource rendering engine, performing parameter filling and logical judgment to generate a personalized marketing instruction for the consumer; executing the personalized marketing instruction, including at least one of the following operations: adding a marketing push task to a message queue, updating the rights record in the user rights database, and injecting an interactive component into the user session; in response to the successful execution of the personalized marketing instruction, constructing a new state transition event containing a timestamp, consumer identifier, marketing activity identifier, source user journey state (i.e., current user journey state), triggering event, target user journey state, and the ID of the successfully executed marketing action command.
[0052] A user feature database is a dedicated data service built to support real-time personalized decision-making. Its core technology lies in its periodic (e.g., every minute) or event-driven extraction of raw data from multiple business data sources (such as order databases, browsing logs, and clickstreams). This raw data undergoes a predetermined feature engineering process (including but not limited to statistical aggregation, sequence modeling, and real-time computation) to generate and update a dynamic feature vector with the consumer identifier as the primary key. This dynamic feature vector consists of a series of numerical or categorical feature fields, such as "total spending in the last 30 days," "last active time," and "preference rating for category A." These features are normalized or standardized for suitability for subsequent rendering or model calculations. User feature databases are typically implemented based on columnar storage or feature service platforms and provide low-latency key-value query interfaces.
[0053] The specific implementation is as follows: First, the marketing action commands defined in the state transition rules are parsed. These commands are structured data objects, from which core elements are extracted: command type (e.g., "send coupon", "upgrade membership level"), marketing resource identifier (e.g., specific coupon ID, membership level ID), and personalized parameter templates. The personalized parameter templates contain placeholders and logical judgment conditions, for example: "Dear ${user_name}, you have received a ${coupon_amount} yuan coupon, valid for ${expiry_days} days." Second, based on the consumer identifier, a query is initiated to the user feature database (e.g., a real-time data warehouse or feature service platform) to obtain the consumer's dynamic feature vector. The dynamic feature vector is a structured numerical array calculated in real-time or near real-time, for example: [Preference Category: "Digital", Recent Average Order Value: 1500, Daily Login Count: 3, ...]. Then, the dynamic feature vector and the personalized parameter template obtained in the previous step are input into the preset resource rendering engine. The preset resource rendering engine contains a template interpreter and a set of feature mapping functions. The template interpreter traverses the placeholders in the personalized parameter template (such as ${user_name}) and calls the corresponding mapping function. The mapping function looks up or calculates the corresponding value from the dynamic feature vector (such as querying the nickname by user ID). For logical judgments in the personalized parameter template (such as "if the cumulative consumption amount > 1000, then display the word 'VIP'"), the preset resource rendering engine will perform judgments and select the rendering path based on the corresponding field values in the dynamic feature vector. The reason for choosing this rendering engine solution is that it encapsulates the volatile business logic (copy, conditions) in a configurable personalized parameter template, while using stable feature data as input, thus decoupling the content generation logic from user data and improving the maintainability and iteration efficiency of marketing content. Third, the preset resource rendering engine outputs the final personalized marketing instructions and executes them, such as adding marketing push tasks to the message queue, updating the rights records in the user rights database, and injecting interactive components into the user session. The personalized marketing instructions are specific task descriptions that can directly drive the operation of downstream systems. For example, a personalized marketing instruction can be: {"type": "PUSH_COUPON", "user_id": "U123", "coupon_id": "C456", "personalized_text": "Dear Zhang San, you have received a 50 yuan digital exclusive coupon...", "channels": ["APP", "SMS"]}.Fourth, after a personalized marketing instruction is successfully submitted to a reliable channel (such as a message queue confirming receipt) or successfully executed, a new state transition event is constructed. This new state transition event records the complete causal chain of this state change: timestamp (the physical time of the event), consumer identifier & marketing campaign identifier (identifying the subject and scenario), source user journey state & target user journey state (clearly defining the state change), triggering event (the type of original user behavior event that caused this match), and the successfully executed marketing action command ID (precisely associating this state transition with the specific, personalized marketing action actually executed). The reason for including the "successfully executed marketing action command ID" in the event record is that it allows for post-event auditing not only to know "what event caused it, what rule was matched, and how the state changed," but also to trace "which specific personalized action was ultimately executed and what parameters it had." This achieves a closed-loop traceability from decision-making to execution, greatly enhancing the system's auditability and transparency, and providing tamper-proof technical evidence for resolving operational disputes and attributing results.
[0054] This embodiment achieves intelligent personalization of marketing actions and refined tracking of operation history. By parsing marketing action commands and obtaining user dynamic feature vectors, it injects real-time, personalized data dimensions into monotonous rule actions, providing technical input for achieving "personalized marketing interactions." Its innovative contribution lies in achieving dynamic personalization through a preset resource rendering engine. It creatively separates personalized parameter templates (business logic) from dynamic feature vectors (real-time data) and dynamically synthesizes them through the rendering engine. Its direct technical effects are: firstly, without modifying the core process code, marketing content and logic can be quickly adjusted and optimized simply by updating personalized parameter templates and dynamic feature vectors, significantly improving the agility and personalization accuracy of marketing activities and solving the technical problems of high change costs and slow response times associated with traditional hard-coding methods. Secondly, by constructing a new state transition event containing the "command ID of successfully executed marketing action", precise traceability across the entire chain is achieved. This not only records state changes but also strongly binds the changes to the specific personalized actions that are ultimately implemented. In a distributed asynchronous execution environment, a complete and verifiable chain of evidence is established from user behavior events -> process state changes -> actual execution of personalized instructions. This greatly enhances the system's capabilities and credibility in operation and maintenance diagnosis, effect analysis, and compliance auditing, and solves the technical problem of "disconnect between decision-making and execution" in traditional log recording, which makes it difficult to accurately attribute causes.
[0055] In one embodiment, obtaining the consumer's dynamic feature vector from a user feature database based on the consumer identifier includes: Based on the consumer identifier, the following operations are performed in parallel: The most recent N user behavior events, with the consumer identifier as the key, are obtained from the real-time stream processing platform and extracted into a real-time behavior preference vector via the feature engineering module, where N is a natural number; the cumulative consumption amount, with the consumer identifier and the current marketing activity identifier as dimensions, is obtained from the aggregated database; the dwell time and interaction depth of the consumer on the current marketing activity page are queried from the session management service, and the current time period activity score is calculated; the real-time behavior preference vector, the cumulative consumption amount, and the current time period activity score are vectorized, concatenated, and normalized to generate the consumer's dynamic feature vector.
[0056] The specific implementation is as follows: First, when the dynamic feature vector of a consumer is obtained, the system (or the service interface of the user feature database) initiates three asynchronous data acquisition and calculation tasks in parallel based on the input consumer identifier and the marketing activity identifier in the context: 1) Real-time behavior preference vector extraction: The system initiates a query to the real-time stream processing platform (such as Apache Flink, Spark Streaming job) to request the most recent N (e.g., N=50) user behavior events (such as browsing, clicking, searching) with the consumer identifier as the key. These raw events are input into the feature engineering module, which executes predefined statistical algorithms and sequence analysis algorithms. For example, it calculates the frequency of each product category in the most recent N events and generates a "category preference distribution vector", such as ["mobile phone": 0.4, "accessories": 0.3, "computer": 0.2, ...]; identifies frequent patterns in the recent event sequence, such as "browse mobile phone -> compare parameters -> view reviews", and encodes this pattern into an identifier or vector. 2) Accumulated spending amount acquisition: The system queries the aggregated database (such as ClickHouse for OLAP or pre-aggregated Hive tables) for pre-calculated accumulated spending amount filtered by consumer ID and current marketing campaign ID. This scalar value directly represents the consumer's historical contribution to the current campaign. 3) Current time period activity score calculation: The system queries the session management service (such as a Redis-based session center) for the consumer's behavioral data within the session associated with the current marketing campaign page. This data primarily includes dwell time and interaction depth. Interaction depth can be measured by counting the number of valid actions on the page (such as button clicks, slider drags, and form field completions). The system then converts these two metrics into a current time period activity score using a pre-defined calculation function. Example calculation: Activity score = w1 * min(dwell time, T_max) / T_max + w2 * min(interaction depth, D_max) / D_max. Where w1 and w2 are pre-defined weights, and T_max and D_max are normalization upper limits. For example, if the user stays for 120 seconds (T_max=300), interacts 5 times (D_max=10), and each interaction has a weight of 0.5, then the score is 0.5*(120 / 300) + 0.5*(5 / 10) = 0.2 + 0.25 = 0.45.Secondly, after the three parallel tasks mentioned above are completed, the system will vectorize and concatenate the real-time behavior preference vector (a multi-dimensional vector), the cumulative consumption amount (a scalar, which can be regarded as a 1-dimensional vector), and the current time period activity score (a scalar) to form a longer original feature vector. Subsequently, the system will normalize the concatenated vector (for example, by using Min-Max normalization or Z-Score normalization) to make the values of each dimension within a uniform scale, which is convenient for subsequent rendering engines or models to use, and generate the final dynamic feature vector.
[0057] This embodiment minimizes the total latency caused by serial I / O waiting by executing queries from real-time streams, aggregation libraries, and session services in parallel. This is a key design feature to meet the real-time requirements of personalized marketing. Its core creative contribution lies in designing a multi-dimensional feature fusion scheme for personalized marketing scenarios, combining "real-time behavioral preferences + cumulative contribution + instantaneous engagement," and providing specific and feasible acquisition and calculation methods for each dimension. The direct technical effects are: First, parallel data acquisition combined with lightweight feature engineering (statistics, sequence analysis, and formula determination) enables the entire process from multi-source data to normalized feature vectors to be completed within tens of milliseconds, even during peak request periods. This achieves high performance and low latency in feature construction, providing timely data input for subsequent personalized rendering. Second, by integrating real-time behavior reflecting short-term interests, cumulative contribution reflecting long-term value, and instantaneous activity reflecting the current interaction state, the generated dynamic feature vectors can more comprehensively and three-dimensionally represent the context of consumers at the moment of decision-making, ensuring the richness and timeliness of the feature vectors. This supports more precise personalized marketing and improves the targeting and effectiveness of marketing actions.
[0058] In one embodiment, generating a personalized marketing instruction for the consumer includes: the preset resource rendering engine loading a resource template corresponding to the marketing resource identifier, the resource template containing populated variable placeholders and conditional logic judgment nodes; injecting fields from the dynamic feature vector into the corresponding variable placeholders according to a preset mapping relationship; sequentially executing the conditional logic judgment nodes and performing logical operations based on the injected variable values to determine whether to activate their associated sub-instructions or resource variants; after traversing all the conditional logic judgment nodes, assembling the activated sub-instructions according to a preset workflow, selecting a determined resource variant, and generating a serialized JSON instruction object containing the execution target, content parameters, and triggering conditions, as the personalized marketing instruction for the consumer.
[0059] The specific implementation is as follows: The preset resource rendering engine receives the marketing resource identifier and dynamic feature vector. First, based on the marketing resource identifier, it loads the corresponding resource template from the template repository (such as a database or configuration file). The resource template is a structured data description, usually in JSON or YAML format, containing two core elements: 1) Variable placeholders, which define the positions of fields to be dynamically populated and their expected data types, such as "{user_name}" and "{discount_amount}". 2) Conditional logic judgment nodes, which define a series of judgment logic based on variable values. Each conditional logic judgment node contains a logical expression (such as cumulative consumption amount > 1000) and its associated sub-instruction or resource variant (for example, adding a "Special Gift for Exclusive Customers" sub-instruction when the condition is met, or selecting a "Premium Version" copy variant). Second, according to the preset mapping relationship, the specific field values in the dynamic feature vector are injected into the corresponding variable placeholders in the resource template. For example, the preset mapping relationship specifies that the field "nick_name" in the dynamic feature vector corresponds to the placeholder "{user_name}" in the template. Third, all conditional logic judgment nodes in the resource template are executed sequentially. For each conditional logic judgment node, the variable references in its logical expression are replaced with the injected actual values, and then the operation of the logical expression (comparison, arithmetic, Boolean operation) is performed. Furthermore, based on whether the operation result is TRUE or FALSE, it is determined whether to activate the specific sub-instruction or resource variant associated with that conditional logic judgment node. The same feature vector input will lead to the same judgment result and execution path. Fourth, after completing the judgment of all conditional logic judgment nodes, all activated sub-instructions are assembled according to the preset workflow order defined in the resource template, and the determined resource variant is selected as the final content. Finally, this information (execution target, content parameters, trigger conditions, etc.) is encapsulated into a structured serialized JSON instruction object. This JSON instruction object is the final personalized marketing instruction, which precisely describes what operation to perform (e.g., "send push"), who to perform it on (consumer ID), what content to perform (filled and selected copy / resources), and under what conditions to execute (e.g., delayed sending).
[0060] This embodiment achieves dynamic, flexible, and controllable marketing instruction generation. By loading resource templates and injecting dynamic features based on preset mapping relationships, it decouples and dynamically combines marketing content with user data, transforming personalization from "hard-coded" to "data-driven." Its core creative contribution lies in the introduction of a template structure containing conditional logic judgment nodes and its sequential execution and dynamic activation mechanism. The direct technical effects are: First, through the conditional logic judgment nodes in the resource templates, complex, user-feature-based marketing logic can be defined without modifying the code (e.g., "If the user is a high-spending and active user, push high-value products; if they are a new user, push a new user gift pack"). This enables flexible multi-branching and complex logical expressions of marketing strategies, greatly improving the complexity and precision of marketing activities, allowing them to adapt to diverse user segments and scenario needs. Second, the entire generation process is based on template parsing, data mapping, and deterministic logic operations, eliminating the need to call complex prediction models. This ensures low latency in generation speed and predictability of output results, guaranteeing the determinism and efficiency of the instruction generation process, which is crucial for marketing outreach scenarios with high concurrency and real-time requirements. Finally, the logic and content of the marketing strategy are encapsulated in configurable resource templates. Operations personnel can quickly adjust marketing campaigns by modifying these templates without requiring technical staff to modify or deploy backend code. This improves the maintainability and iteration efficiency of marketing content management, significantly reduces the iteration cost and time of marketing campaigns, and enhances business responsiveness. Therefore, by combining a pre-defined resource rendering engine with configurable resource templates and deterministic logic execution, this technical solution addresses the technical challenges faced by traditional marketing systems when implementing complex, dynamic, and personalized strategies, such as insufficient flexibility, slow iteration, and coupling between logic and code.
[0061] In one embodiment, the preset resource rendering engine is a declarative domain-specific language interpreter, and the personalized parameter template is a script written in the corresponding domain-specific language; the execution parameter filling and logical judgment includes: parsing and executing the script, wherein the variable references in the script are bound to the fields in the dynamic feature vector, and the conditional statements in the script are used to determine the activated sub-instruction or resource variant.
[0062] Declarative Domain-Specific Language (DSL) refers to a computer language designed specifically to solve problems in a specific domain (in this embodiment of the invention, "marketing resource rendering and personalized decision-making"). Its characteristic is that it is declarative, meaning that users (such as operations personnel) describe "what" through the language, such as "send a premium copy if the user is a VIP," without having to write detailed "how" step-by-step code like in imperative languages. This allows people without technical backgrounds to understand and write relatively complex business logic.
[0063] A declarative domain-specific language interpreter is a software program that can read, parse, and execute scripts (i.e., personalized parameter templates) written in the aforementioned declarative domain-specific language. Its working principle is similar to a miniature compiler: it receives the script as input, performs lexical analysis and syntax analysis, builds an executable abstract syntax tree in memory, and then traverses this tree through an execution engine. Based on the declarative logic in the script, it performs calculations and decisions in combination with the input data (dynamic feature vectors), and finally outputs the result (personalized marketing instructions).
[0064] The specific implementation is as follows: In this embodiment of the invention, the preset resource rendering engine is a declarative domain-specific language interpreter, and its workflow is as follows: First, based on the marketing resource identifier, the corresponding script written in the declarative domain-specific language is loaded. Second, the interpreter performs lexical analysis (decomposing the character stream into tokens such as identifiers, keywords, and operators) and syntactic analysis (constructing an abstract syntax tree according to the syntax rules of the DSL). Third, the execution context is obtained, which contains a dynamic feature vector (which may be wrapped as an object such as user.feature), and the variable references in the script (such as user.feature.cumulative consumption amount) are bound to the actual fields in the dynamic feature vector. Subsequently, the abstract syntax tree is traversed. When an assignment statement (such as content = ...) is encountered, the engine performs string interpolation, replacing the placeholder with the bound variable value; when a conditional statement (such as if (user.feature.cumulative consumption amount>1000) { ...}) is encountered, the engine calculates the value of the conditional expression (performing a numerical comparison). Based on whether the calculation result is true or false, the engine decides whether to execute the statements within its code block, thereby dynamically "activating" or "deactivating" specific sub-instructions (such as attach_sub_instruction) or selecting specific resource variants (such as content_variant = "premium"). Fourth, after the script finishes execution, all assigned variables and activated instructions are collected and assembled into the final personalized marketing instructions according to a preset format (such as JSON).
[0065] This embodiment elevates the configuration capabilities and execution efficiency of personalized marketing logic to a new level by introducing a declarative domain-specific language (DSL) and its interpreter. By using a declarative DSL, complex, multi-branching marketing logic can be expressed and written in a manner close to natural language and business concepts, significantly lowering the barrier for business personnel to understand and maintain personalized strategies. Its core creative contribution lies in designing and applying a declarative DSL and its interpretation and execution mechanism specifically for the domain of "marketing resource rendering and personalized decision-making." The direct technical effects are: First, DSL scripts can express more complex logic (such as loops, function calls, and complex condition combinations) than fixed template structures. This allows operations personnel to design marketing campaigns as if writing short programs, greatly expanding the complexity and diversity of achievable personalized scenarios, achieving ultimate flexibility and programmability of business logic, and overcoming the limitations of general-purpose template engines in terms of expressive capabilities. Second, compared to using general-purpose scripting languages (such as JavaScript), the interpreter of a domain-specific language can be deeply optimized for marketing domain operations (such as feature access, condition judgment, and instruction assembly), resulting in higher execution efficiency. Finally, as an independent configuration file, the DSL script can be quickly modified, version managed, and A / B tested. It can efficiently achieve script pre-parsing, caching, and hot reloading, enabling strategy changes to take effect almost instantly, significantly shortening the launch and optimization cycle of marketing campaigns.
[0066] In one embodiment, parsing the state flow definition file includes: obtaining the marketing activity identifier contained in the state flow definition file; loading the activity metadata constraints corresponding to the marketing activity identifier, wherein the activity metadata constraints include a set of allowed user journey states, a set of allowed user behavior events, and a preset state irreversibility rule; parsing the syntax and structure of the state flow definition file to extract all the state transition rules defined therein, forming an initial state transition rule set R; verifying whether the source user journey state and the target user journey state of each state transition rule r in the initial state transition rule set R belong to the set of allowed user journey states, and verifying whether its triggering event belongs to the set of allowed user behavior events; constructing a directed state transition graph with user journey states as nodes and state transition rules as directed edges based on the state flow definition file, and detecting whether there are loops in the directed state transition graph that violate the state irreversibility rule based on a depth-first search algorithm; if all verifications pass, marking the state flow definition file as valid and generating the state transition rule set; otherwise, generating and returning a verification failure report containing specific violation entries.
[0067] Activity metadata constraints represent a predefined set of rule-based metadata for a given marketing campaign. These constraints define the legal boundaries and basic semantics of the campaign's workflow orchestration and are typically configured by the platform administrator or campaign creator during campaign setup. They include: 1) A set of allowed user journey states, defining a list of all possible states a consumer can be placed into during the campaign (e.g., "Not Participating," "Registered," "In Progress," "Meets Goals," "Expired"). Any state outside this set is invalid. 2) A set of allowed user behavior events, defining a list of all types of consumer behavior the system can recognize and respond to during the campaign (e.g., "Click to Register," "Submit Assignment," "Complete Check-in," "Request Refund"). Any undeclared event types will be ignored. 3) Preset non-reversible state rules define directional constraints on state transitions. These rules may exist in the form of a whitelist (paths that are allowed to revert), a blacklist (paths that are prohibited from reverting), or global rules (such as "except for specific 'undo' events, states with larger status codes cannot revert to states with smaller status codes") to prevent illogical state loops in business logic (e.g., reverting from "completed" to "in progress").
[0068] The specific implementation is as follows: First, the marketing campaign identifier is extracted from the state flow definition file. Using the marketing campaign identifier as the key, the activity metadata configuration library is queried to load the corresponding activity metadata constraints, including the three core sets / rules mentioned above. Second, lexical and syntactic analysis is performed on the state flow definition file (the parsing process is based on existing technology and will not be elaborated here). After verification, all state transition rules defined in the state flow definition file are extracted to form an initial state transition rule set R. Each state transition rule r contains a source user journey state, a triggering event, and a target user journey state. Third, each state transition rule r in the initial state transition rule set R is traversed, and two basic checks are performed: 1) State check: Checking whether the source user journey state and the target user journey state of state transition rule r both exist in the allowed user journey state set. 2) Event check: Checking whether the triggering event of state transition rule r exists in the allowed user behavior event set. This ensures that all user journey states and triggering events defined in the process are within the legal scope preset by the activity, preventing invalid rules or untriggered process nodes due to spelling errors or unauthorized configurations, thus improving the accuracy and reliability of the configuration. Fourth, based on the state flow definition file, a directed graph (state transition directed graph) is constructed, with "user journey states" as nodes and "state transition rules" as directed edges. Then, for the prohibited rollback relationships defined by the preset non-rollback rules, a graph theory check is performed. Specifically, if rolling back from a higher state to a lower state is prohibited, the graph should not contain any loops starting from a higher state node and eventually returning to that higher or lower state node. A depth-first search algorithm is used to traverse the directed graph to check for loops that violate the constraints. The technical effect of this step is to eliminate logical defects that could cause the state machine to enter an infinite loop or produce unexpected state rollbacks at the configuration level, ensuring the robustness and determinism of the process logic. Fifth, if all the above verifications pass, the state flow definition file is marked as valid, and a set of state transition rules that can be stored and indexed is generated. Otherwise, if any verification fails, a verification failure report is generated, clearly indicating which rule violated which constraint (such as "Rule R5: Target state 'Cancelled' is not in the allowed set" or "An illegal rollback loop from 'Paid' to 'Pending' was detected"), to facilitate quick location and repair of configuration errors.
[0069] This embodiment, by constructing a multi-layered, automated configuration verification process, achieves the legality review of basic process elements, preventing obvious configuration errors from entering the system. Its core creative contribution lies in abstracting state transition logic into a directed graph model and applying graph theory algorithms (depth-first search) to automatically verify the logical consistency of preset business rules (states cannot be rolled back). The direct technical effects are: First, through automated and rigorous semantic and logical verification, complex logical loops and state definition errors can be accurately identified, thereby eliminating a large number of potential runtime fault sources before deployment, greatly reducing the risk of online incidents caused by configuration errors, significantly improving configuration quality and system reliability, and enhancing the stability and reliability of the entire process orchestration system. Second, by transforming complex logical consistency judgments into deterministic graph traversal calculations, the verification process is fast, objective, and the results are reproducible, achieving efficient and reproducible automated verification. Finally, by enforcing business logic constraints such as the rule that states cannot be rolled back, we ensured that the online process state machine strictly conformed to the business design intent, guaranteed the rigor and controllability of the business process, avoided data inconsistencies and business disputes that may be caused by state chaos, and enhanced the technical controllability of the business process.
[0070] In one embodiment, the method further includes: if no matching state transition rule is found, capturing a matching failure event and recording its context information, the context information including consumer identifier, marketing campaign identifier, current user journey state, user behavior event, and timestamp; inputting the context information into an anomaly rule mining model, the anomaly rule mining model analyzing the potential association between historical matching failure events and successfully defined rules based on an association rule mining algorithm; if the anomaly rule mining model outputs a potential new rule suggestion with a confidence level higher than a preset confidence threshold, pushing the potential new rule suggestion along with the context information to the rule administrator's pending review queue; and, based on the current user journey state and the user behavior event, retrieving a highest-priority default execution rule from the default execution rule library; executing the marketing action command defined by the default execution rule, and persisting the transition corresponding to the default execution rule as "default rule execution" to the event log.
[0071] Anomaly rule mining models represent data analysis programs based on offline or near real-time computation. Their core function is to discover potential association patterns between failed matching events and existing defined rules. They typically employ association rule mining algorithms (such as Apriori or FP-Growth). They take the contextual information of historically accumulated failed matching events (especially the combination of the current user journey state and user behavior events) and the defined set of state transition rules as input. Through statistical calculations, they identify frequently occurring "state-event" combinations that have not yet been explicitly defined as rules, and calculate the confidence of these combinations as valid rules (i.e., the probability that a combination should trigger a subsequent action when it occurs). The output is a "potential new rule suggestion," which includes a specific "source user journey state - triggering event - suggested action (or target user journey state)" triple and its confidence.
[0072] The specific implementation is as follows: When the query returns "miss" (null value), the exception handling process is triggered: First, the system captures this matching failure event and stores its complete context information (consumer identifier, marketing campaign identifier, current user journey status, user behavior event, timestamp) as a record in a dedicated matching failure log. Secondly, periodically (e.g., daily), the anomaly rule mining model is triggered. It reads the matching failure logs from the recent period and the currently valid set of state transition rules. First, it groups the failure events by marketing campaign identifier. For each marketing campaign, it treats each failure event's (current user journey state, user behavior event) as an "item". Then, it runs an association rule mining algorithm (e.g., FP-Growth). This algorithm identifies frequent itemsets. For example, it might find that the combination (state = "items in shopping cart", event = "browsing competitor's product details page") appears frequently in the failure logs (high support). When this combination appears, if there has been a subsequent user behavior in the past (e.g., "return and add the original item to cart"), a potential rule can be inferred: when the state is "items in shopping cart" and the event is "browsing competitor's product details page", the "send coupon to retain user" action should be triggered, and a confidence level is calculated for this rule (e.g., 80% of such failure events result in the user returning to make a purchase if they receive a retention coupon). All potential new rule suggestions with a confidence level higher than a preset confidence threshold (e.g., 70%), along with their source context statistics, are pushed to the rule administrator's pending review queue. The reason for using association rule mining and setting a confidence threshold is that it provides a data-driven, quantifiable way to automatically discover high-value rule candidates from a large number of failure cases, avoiding the inefficiency and subjectivity of manual screening, and retaining the final decision-making power (review) to the human, ensuring the controllability and security of rule additions. Third, while asynchronously initiating mining analysis, it is necessary to respond immediately to current failure events. Therefore, the system maintains a default execution rule library, which contains a series of general, low-risk rules (e.g., "Log and end process when no match" or "Send general care message when no match"). Based on this, the system retrieves the highest-priority default execution rule from this default execution rule library according to the current user journey state and user behavior events, and executes the marketing action command defined within it. After execution, the system generates a new state transition event, with the transition reason explicitly marked as "default rule execution," and persists it to the event log.
[0073] This embodiment significantly enhances the system's adaptability and continuous evolution capabilities through parallel processing of "real-time degradation execution + offline mining suggestions." By capturing matching failure events and recording their context, it systematically transforms the knowledge gaps exposed during system operation into analyzable data assets. Its core creative contribution lies in the innovative application of association rule mining algorithms to the knowledge discovery scenario of process rules, and the design of a human-machine collaborative optimization closed loop of "mining-suggestion-review." The direct technical effects are: the system can proactively learn from its own "uncovered" behavioral patterns and generate high-quality rule supplement suggestions, achieving automated rule set management and data-driven continuous optimization. This greatly reduces the workload and response latency of manual rule maintenance and gap filling, allowing the rule base to dynamically evolve with changes in user behavior, improving the system's long-term adaptability and intelligence level, and enhancing its intelligence and robustness.
[0074] It should be noted that the visual process arrangement method for e-commerce marketing described in the above embodiments can be recombined with the technical features included in different embodiments as needed to obtain a combined implementation scheme, but all of them are within the protection scope claimed by this invention.
[0075] Those skilled in the art will understand that the methods provided in the embodiments of the present invention can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. The methods can also be implemented as a computer program product stored in one or more computer-readable storage media, including but not limited to: disks, optical disks, read-only memory (ROM), random access memory (RAM), flash memory, etc. When the computer program product is executed by one or more data processing devices (such as computers), the devices perform the steps as described in any of the foregoing method embodiments.
[0076] Software tools, components, or models not belonging to this company that appear in the embodiments of this invention are merely illustrative examples and do not represent actual use. The data collection methods used in the embodiments of this invention comply with relevant laws and regulations, such as the "Data Security Law of the People's Republic of China," the "Personal Information Protection Law of the People's Republic of China," GDPR (General Data Protection Regulation of the European Union), or information security standards of other countries and regions.
[0077] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A visual workflow orchestration method for e-commerce marketing, applied to a server, characterized in that, The method includes: Receive a state flow definition file, which defines state transition rules based on user journey state and user behavior events. The user journey state represents the consumer's staged identity or rights status in a marketing activity, and the user behavior event represents an interactive operation event triggered by the consumer. Parse the state flow definition file to generate and store a set of state transition rules with consumer identifier and marketing campaign identifier as a joint index; Acquire consumer user behavior events, which include consumer identifiers and marketing campaign identifiers; Based on the consumer identifier and the marketing campaign identifier, the historical state transition event sequence of the consumer is obtained from the event log, and the current user journey state of the consumer under the current marketing campaign is calculated based on the historical state transition event sequence. Based on the marketing campaign identifier, obtain the corresponding state transition rule set, and use the current user journey state and the user behavior event as input to perform a matching query in the state transition rule set; If a matching state transition rule is found, the marketing action command defined by the matching state transition rule is executed, and a corresponding new state transition event is generated and persisted to the event log to update the consumer's user journey state.
2. The method as described in claim 1, characterized in that, Based on the historical state transition event sequence, calculate the consumer's current user journey state under the current marketing campaign, including: Based on the historical state transition event sequence, a total order sort is performed on the vector clock tags recorded in the historical state transition events to determine the global order of concurrent events generated across different servers or threads, and a globally ordered event stream is generated. Each state transition event is labeled with a vector clock tag by the processing server based on the logical clock protocol when it is persisted to the event log. In the globally ordered event stream, detect whether there are concurrent conflict events that target the same combination of {consumer identifier, marketing campaign identifier}, have the same vector clock logical time, but differ from at least one of the source user journey state and the triggering event; If the concurrent conflict events exist, a state transition event is selected as a valid event from the concurrent conflict events according to a preset conflict resolution strategy. The conflict resolution strategy includes at least one of the following: a priority strategy based on event type, a deterministic selection strategy based on server ID, and a comparison strategy based on event-attached weights. The effective event stream after total ordering and conflict resolution is provided as input to a deterministic finite state machine. The state set of the finite state machine is all possible user journey states defined by the current marketing campaign, and the transition rules are defined by the state transition rule set. Each valid event is processed sequentially. The previous user journey state is used as the current state to drive the finite state machine to deterministically transition to the target user journey state corresponding to the valid event, as defined by the state transition rule set, and update the target user journey state to the current user journey state. After each state transition, a latest state snapshot corresponding to the {consumer identifier, marketing campaign identifier} combination is generated and stored. The latest state snapshot includes: the current user journey state, the state version number that monotonically increases with the state transition, and the vector clock tag of the valid event corresponding to this state transition. The latest state snapshot is synchronously updated to the distributed state cache. When it is necessary to obtain the current user journey state of the consumer, the current user journey state in the latest state snapshot is read from the distributed state cache and returned.
3. The method as described in claim 2, characterized in that, The method also includes periodically performing the following processes: Based on the incremental log or pre-write log of the event log, identify the state transition events that have been added or modified since the last maintenance cycle, and extract the associated {consumer identifier, marketing activity identifier} combination to form a set to be verified. For each combination in the set to be verified, read its currently stored state snapshot A from the distributed state cache, re-execute the deterministic state advancement steps based on all events of the combination after the version number of state snapshot A, calculate the theoretically latest state snapshot B, and compare the current user journey state and version number in state snapshot A and state snapshot B. If state snapshot A is inconsistent with state snapshot B, update the record in the distributed state cache to state snapshot B and generate a cache repair log. Scan the distributed state cache and lazy-delete or mark as expired records whose last update time is earlier than the start time of the current marketing campaign cycle or whose associated marketing campaign has ended.
4. The method according to any one of claims 1-3, characterized in that, Performing a matching query in the state transition rule set includes: Construct an in-memory hash index with {marketing campaign identifier, source user journey state, user behavior event} as the composite key, wherein the source user journey state is the migration start state defined by the state migration rule; The current user journey state and the user behavior event are combined with the marketing campaign identifier to form a key combination to be queried; Based on the memory hash index, a key-value query operation is performed. If a match is found, the matching state transition rule and its defined target user journey state and marketing action command are returned; if no match is found, an empty value is returned.
5. The method as described in claim 4, characterized in that, Execute the marketing action commands defined by the matching state transition rules and generate corresponding new state transition events, including: Parse the marketing action commands to identify their command types and associated marketing resource identifiers and personalized parameter templates; Based on the consumer identifier, the dynamic feature vector of the consumer is obtained from the user feature database. The dynamic feature vector includes real-time behavioral preferences, cumulative consumption amount, and activity level in the current time period. The dynamic feature vector and the personalized parameter template are input into the preset resource rendering engine, and parameter filling and logical judgment are performed to generate the personalized marketing instructions for the consumer. Executing the personalized marketing instructions includes at least one of the following operations: adding a marketing push task to the message queue, updating the rights record in the user rights database, and injecting interactive components into the user session; In response to the successful execution of the personalized marketing instruction, a new state transition event is constructed, which includes a timestamp, consumer identifier, marketing campaign identifier, source user journey state (i.e., current user journey state), triggering event, target user journey state, and the ID of the successfully executed marketing action command.
6. The method as described in claim 5, characterized in that, Based on the consumer identifier, the dynamic feature vector of the consumer is obtained from the user feature database, including: Based on the consumer identifier, perform the following operations in parallel: The most recent N user behavior events, with the consumer identifier as the key, are obtained from the real-time stream processing platform and extracted into a real-time behavior preference vector through the feature engineering module, where N is a natural number. Retrieve the cumulative spending amount from the aggregated database, using the consumer identifier and the current marketing campaign identifier as dimensions; The session management service queries the duration and interaction depth of the consumer on the current marketing campaign page, and calculates the activity score for the current time period. The real-time behavioral preference vector, the cumulative consumption amount, and the current time period activity score are vectorized, concatenated, and normalized to generate the consumer's dynamic feature vector.
7. The method as described in claim 5, characterized in that, Generating personalized marketing instructions for the consumer includes: The preset resource rendering engine loads the resource template corresponding to the marketing resource identifier. The resource template contains populated variable placeholders and conditional logic judgment nodes. Based on the preset mapping relationship, the fields in the dynamic feature vector are injected into the corresponding variable placeholders; The conditional logic judgment nodes are executed sequentially, and logical operations are performed based on the injected variable values to determine whether to activate their associated sub-instructions or resource variants. After traversing all the conditional logic judgment nodes, the activated sub-instructions are assembled according to the preset workflow, and a determined resource variant is selected to generate a serialized JSON instruction object containing the execution target, content parameters, and trigger conditions, which serves as the personalized marketing instruction for the consumer.
8. The method as described in claim 5, characterized in that, The preset resource rendering engine is a declarative domain-specific language interpreter, and the personalized parameter template is a script written in the corresponding domain-specific language; Execution parameter filling and logical judgment, including: The script is parsed and executed, wherein variable references in the script are bound to fields in the dynamic feature vector, and conditional statements in the script are used to determine the activated sub-instruction or resource variant.
9. The method as described in claim 1, characterized in that, Parsing the state flow definition file includes: Obtain the marketing activity identifier contained in the state flow definition file, load the activity metadata constraints corresponding to the marketing activity identifier, the activity metadata constraints include the allowed set of user journey states, the allowed set of user behavior events, and preset state non-reversal rules; The state flow definition file is parsed for syntax and structure, and all the state transition rules defined therein are extracted to form an initial state transition rule set R; For each state transition rule r in the initial state transition rule set R, verify whether its source user journey state and target user journey state belong to the allowed user journey state set, and verify whether its triggering event belongs to the allowed user behavior event set. Based on the state flow definition file, a directed state transition graph is constructed with user journey states as nodes and state transition rules as directed edges. A depth-first search algorithm is used to detect whether there are loops in the directed state transition graph that violate the state non-retrogression rule. If all validations pass, the state flow definition file is marked as valid, and the state transition rule set is generated; otherwise, a validation failure report containing specific violation entries is generated and returned.
10. The method as described in claim 1, characterized in that, The method further includes: If no matching state transition rule is found, capture the matching failure event and record its context information, which includes consumer identifier, marketing campaign identifier, current user journey state, user behavior event and timestamp; The context information is input into the anomaly rule mining model, which analyzes the potential associations between historical matching failure events and successfully defined rules based on the association rule mining algorithm. If the abnormal rule mining model outputs a potential new rule suggestion with a confidence level higher than the preset confidence threshold, the potential new rule suggestion along with the context information is pushed to the rule administrator's pending review queue. Furthermore, based on the current user journey state and the user behavior event, a default execution rule with the highest priority is retrieved from the default execution rule base; Execute the marketing action command defined by the default execution rule, and persist the migration corresponding to the default execution rule as "default rule execution" to the event log.
Citation Information
Cited By
A data processing method, device and system for a relational database, and a storage medium
CN122241773A