How to integrate different “microservices” into a transaction?

We’re building a new web-based industrial application and one of the questions that are hammering our heads for the last few days is about the integration between different “microservices” on this architecture.

I’m using microservices with just a pinch of salt because we’re not totally embracing the concepts to define real microservices. One (and I think the biggest) difference relies on the fact that we’re using the same shared database along the different modules (that I’m calling “microservices”). A sort-of logical view of our system could be drawn as:

                  ╔══════════════╗                   ║    Client    ║ ══╗                   ╚══════════════╝   ║ (2)                                      ║                                      ▼                 ╔══════════════╗  (1) ╔══════════════╗         ║  Serv. Reg.  ║ <==> ║  API Gatew.  ║         ╚══════════════╝      ╚══════════════╝             █       █   █████████████     (4)            █         █              ████ ╔══════════════╗  ╔══════════════╗  ╔══════════════╗ ║   Module A   ║  ║   Module B   ║  ║   Module C   ║  <===== "Microservices" ╚══════════════╝  ╚══════════════╝  ╚══════════════╝         ║║ (3)           ║║ (3)            ║║ (3)         ║║               ║║                ║║ ╔══════════════════════════════════════════════════╗ ║                Database Server                   ║ ╚══════════════════════════════════════════════════╝ 

Some things that we’ve already figured out:

  • The Clients (External Systems, Frontend Applications) will access the different Backend Modules using the Discovery/Routing pattern. We’re considering the mix of Netflix OSS Eureka and Zuul to provide this. Services (Modules A,B,C) registers themselves (4) on the Service Registration Module and the API Gateway coordinates (1) with the Register to find Service Instances to fullfill the requests (2).
  • All the different Modules use the same Database. (3) This is more of a client’s request than a architecture decision.

The point that we (or me, personally) are stuck is about how to do the communication between the different modules. I’ve read a ton of different patterns and anti-patterns to do this, and almost every single one will tell that API Integration via RestTemplate or some specialized client like Feign or Ribbon.

I tend to dislike this approach for some reasons, mainly the synchronous and stateless nature of HTTP requests. The stateless-ly nature of HTTP is my biggest issue, as the service layer of different modules can have some strong bindings. For example, a action that is fired up on Module A can have ramifications on Modules B and C and everything needs to be coordinated from a “Transaction” standpoint. I really don’t think HTTP would be the best way to control this!

The Java EE part inside of me screams to use some kind of Service Integration like EJB or RMI or anything that does not use HTTP in the end. For me, it would be much more “natural” to wire a certain Service from Module B inside Module A and be sure that they participate together on a transaction.

Another thing that needs to be emphasized is that paradigms like eventual inconsistencies on the database are not enough for our client, as they’re dealing with some serious kind of data. SO, the “I promise to do my best with the data” does not fit very well here.

Time for the question:

Is this “Service Integration” really a thing when dealing with “Microservices”? Or the “Resource Integration” wins over it?

It seems that Spring, for example, provides Spring Integration to enable messaging between services as would a tech like EJB do. Is this the best way to integrate those services? Am I missing something?

PS: You may call my “Microservices” as “Microliths”, how we usually name them around here. 🙂

System restarted before transaction is committed

Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.

T1 start  T1 B old=1200 new=10000 T1 M old=0 new=2000 T1 commit T2 start T2 B old=10000 new=10500 T2 commit 

Suppose the database system crashes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?

(a) We must redo log record 6 to set B to 10500

(b) We must undo log record 6 to set B to 10000 and then redo log records 2 and 3

(c) We need not redo log records 2 and 3 because transaction T1 has committed

(d) We can apply redo and undo operations in arbitrary order because they are idempotent

According to me, the answer should be (a), as transaction T1 has been committed and has been written back into memory. But my solution says that the answer should be (b).

Am I right or what am I doing wrong?

Thanks in advance!

How are these transaction fingerprints colored?

For those unfamiliar, blockchains have two main types of data structures propagated in their networks: blocks and transactions. Each block and transaction has a hash, just like key fingerprints. The following block explorer called Blockchair uses colored representations of sha256 hashes. What method is used to do this?

Example transaction hash

I’ve seen similar things like the Drunken Bishop cipher used by SSH, as well as the blockies identicon library used by some Ethereum GUI clients (which uses original Keccak-spec public key/contract hashes).

how bitcoin reject invalid transaction?

i’m studying ‘Mastering Bitcoin’ and have a questions,

in this book, we can send coin to other wallet by createrawtransaction but there is no enough secure method.

we can find other’s wallet addresses at and unused coin value too.

for example –

718ae88f0eb13d2f2d3bc74cbf18721a82739b80f1bfc0658ed699263fca76fd(Fee: 0.00002057 BTC – 3.11 sat/WU – 8.33 sat/B – Size: 247 bytes) 2019-01-14 04:57:04 34bN2MQcqA4JpbEVRU9KBsvhXgSEHQrqBz (1.13215222 BTC – Output) 32T5urH6uN4jhKenhW4LWM66WouzSCERbA – (Spent) 0.03213165 BTC 3LnZGyRAeCA3LAMBU2RSQn6dAkHw8rWquw – (Unspent) 1.1 BTC

than we can make fake transaction such as

$ bitcoin-cli createrawtransaction ‘[{“txid” : “718ae88f0eb13d2f2d3bc74cbf18721a82739b80f1bfc0658ed699263fca76fd”,”vout”:0}]’ ‘ {“MY WALLET ADDRESS”: 1.0, “3LnZGyRAeCA3LAMBU2RSQn6dAkHw8rWquw“: fee}’

in conclusion, it doesn’t works but i want know why this code not working

Transaction haven`t got

5 days ago some Pokerroom sent to my Bitcoin Core wallet a slight amount of bitcoin. I checked it on Blockchain, its ok. But, unfortunately, still there is no bitcoins in my wallet. Ive also sent email here – with explanation of the problem.

Who`s already gone through situation like this please give me advise what to do.

Many thanks, Kirill

Rules for showing transaction history

Aside from it being a best practice and just good design, are there any known rules dictated by banks and/or by the FTC (or similar agency) that dictate the rules for the display of transaction history on a website where a user can purchase a good or serice (digital and/or physical goods).

I can’t think of a single company that has an online presence where you can buy something and not see a complete history of all transactions – credits, purchases, chargebacks, etc to one’s account.

If anyone knows of any resources that I can cite, I would be very appreciative.

Mine a block without transaction

I came to know that there are people who mine a new block without any transaction. I understand that this is just to get the block reward.


Question .

  1. What is the problem if they include the transactions in it.
  2. Why the Bitcoin client protocol has this feature to mine a empty block ?