Who should do it?

background

Do a project, I encountered a problem. As shown, the process is as follows:

STEP1: single protocol initiated under the agreement, the next single after the success of, access to E single number;

STEP2: E protocol uses a single number to call on behalf of the service charge;

STEP3: E-generation services will charge a single number X into a single number, then use the payment acquiring services, the payment was successful.

STEP4: news transaction listener acquiring, payment processing callbacks.

The question is: As the service charges on behalf of the E X into a single number a single number, payment message to the transaction, only a single X number. X single transaction does not recognize the number, order number reported illegal.


discuss

Intuitively would think: single transaction should get X number corresponding to E single number, then go for further processing. To accomplish this function, you can really do. However, doing so is right?

Relativity and change the role of

In this example, it is easy to realize: It should have a process of global leader, the single Under the agreement, pay to complete the life cycle in series.

From the business, this is the next single protocol traffic, in theory, the agreement should be the business side; from the process point of view, a single party under the agreement, call charge, do also control the flow of things. However, the parties to the agreement believe that he was just the protocol service should not be concerned about so many things.

But I think, role definition is relative, you can switch between basic services and the global flow control. Such transaction, placing an order process, the transaction is the leading role, calling merchandise, marketing, payment, membership, etc., the transaction-related information aggregation up for falling, the whole buying process to string together; but more upstream business, such as micro mall, retail, education, trade and as a basic service module.

Similarly, although the parties to the agreement is a basic service, you should not pay attention to orders that sort of thing, but in the context of a single business in this agreement, it should play a leading role flow control.

We can do and should do

In discussing the issue, often there will be some fuzzy boundaries, the boundaries of each service module can be done, but - do, you should do it?

This involves the positioning problem. Positioning the transaction is: create orders, order lifecycle management. The agreement also has its own positioning: dealing with the relationship between the members and businesses.

It appears that for this example, trading and positioning protocols are not suitable to do this thing.

Spoken ability

Students also proposed a protocol point of view: If you have a business party A, B, C, under a single successful offspring also need the ability to charge, but does not require protocol capability, is not every business side needs to do something similar? Can refining capacity is universal?

good question. It appears that the transaction eat this logic, whether the transaction is beneficial to the business side.

Under careful analysis. Generic capabilities, and generally comprise distinct portions of the same part. You can reuse the same parts, different portions of the extension point used to achieve.

In this example there: the same part will be obvious: single success -> Services on behalf of deductions -> listen acquiring information, order status change has been paid. At one go, how good!

So, what is the potential problem?

  1. If the representative of a failed charge, how to deal with?

  2. If the payment is successful, the business side need to do some processing, and then modify the order status, how to do?

It is said that these two issues can be achieved by extending the point ah! Here are derived with two topics.

Over-design

Consider the system's versatility and scalability are reasonable, but if you want to do it in the first complete it? By way of extension points, appears to be the perfect support for these features, however, if the follow-up for a long time do not need similar capabilities, the design and implementation of the extension point it is easy to become a high complexity, low maintainability, cost high over-designed program.

In addition, the transaction process dependent on upstream core extension point implementation, infrastructure services rely on business to achieve, it is dependent on the anti-pattern, easily lead to reliability problems. Visible, although universal extension point, but not abused.

Multiplexed mode

Multiplexing mode is idealized: define a universal process, this process has many slots that are extension points, and can be implemented for insertion upstream.

The actual system, more commonly used for the core of the place, will define some slots. But: if more slots finer, more flexible ability to support the better it?

There is also a relatively low level but effective multiplexing modes: puzzle is to provide a series of upstream can go mosaic picture of their business according to their needs.

One is inserted into many small slot in the core processes, the business side can insert your own implementation, the ability to complete the customization. But in this way there drawbacks: the more slots, the more difficult to understand and maintain; core processes rely realize the business side, the more likely the more unstable core processes.

One is the basic service provided only basic puzzle, according to their own requirements to splice the business side. In this way, the business side more flexibility and freedom, but there will be a lot of similar things to be repeated.

Which do you prefer? Is there a better solution to solve this problem?

precedent

Encounter problems, to find precedents for reference is a way.

Such as retail, we have also experienced similar problems. At that time the approach taken is: do one retail revenue conversion order number and order number, and then call the callback payment transaction services provided, the order status is updated to have been paid.

Whether the precedent can be used under the current scenario, it is worth careful consideration.

Cost measure

One important factor: to achieve cost and risk considerations.

Transaction: need to call on behalf of the debit service query interface, do one conversion. Risk: As the trading volume is very large orders, while the real need to call debit orders on behalf of the service interface is very small, it may result in: more than a 95% of the orders did not need to call this interface; b-generation service charge easily. hooking;. c-generation service charge if pulled linked to the stability of the core processes of the transaction will be seriously affected.

Agreement: the need to call on behalf of their own debit service query interface, make one convert, and then calls the callback payment transaction services provided, the order status is updated to have been paid. Risk: None. However, non-reusable, but seemingly not suitable positioning protocol.

On behalf of the service charge: make one convert, X will turn into a single number E single number, then passed through acquiring services, acquiring services like payment acquirer with a message before sending. Risk: It may affect some of the original service payments.

From the implementation cost and risk perspective, the agreement is more suitable to do it.


summary

In large projects, often because the system there will be some fuzzy boundaries and lead to "gray functional areas." Each system adjacent to the "gray area", seems to have the right to implement this feature gray area. So who should do it then? This article presents some basic considerations:

  • In the current business scenario, who is the master of the process?
  • In the current business scenario, who has a right to interpret the information?
  • Positioning system is like? Whether functional requirements for receiving the "gray area"?
  • In general capabilities, while considering whether there is over-designed suspects?
  • Implementation is easy to understand, maintain, reliable and stable?
  • What is the use of multiplexing in the form of more appropriate?
  • How to achieve cost and risk?
  • Whether precedents can refer to?

Guess you like

Origin www.cnblogs.com/lovesqcc/p/11932840.html