Sorry you are right I was in different mind set…you are almost there:
Next number retrieves from the table:
Obtaining Control Numbers for Outbound Processing (ANSI X12 and
The EDI Module maintains information about control numbers in the EDIControlNumber table, which is an EDI Module‐specific table in the Trading
Defining Control Number Settings covers the topic:
You can review the user guide for more basic information
EDI ControlNumber table will have control numbers defined for specific sender, receiver and group type from Admin page.
Service “wm.b2b.edi.util:controlNumber” isn’t related to that table since this doesn’t take any defined sender or receiver as inputs. This service is to generate a unique number every time irrespective of any situation. It works totally independently.
but, when it generates it caches the value somewhere so that it can use it for next time.
I’m missing the point where it stores? Please anybody help
If you run this service twice, you’ll see the second number is subsequent number to the first one.
I was trying to figure out where exactly it stores the first number to create the second. Of course that idea is turned out to be a dud. I figured better to avoid using this service rather use DB sequence number stuff.
But anyways, you are right. this service is useless. from my testing, it is generating unique numbers when running as multiple threads on one server. but when I run this service, from multiple servers in one cluster with multiple threads which share same database, its surely generating duplicates since its not synchronized across cluster.
In memory it keeps what the service description refers to as the “random system number.” So it keeps only that portion, not the entire the string. On restart, the “random” number sequence will restart. And as you’ve noted, multiple IS instances can and will create the same number.
I’ve found it best to use the EDIControlNumber table. Doing so follows the common practice of using sequential control numbers for group and interchange envelopes to support tracking and control number gap detection. (If you’re not already aware, the common practice for tx sets is to always start at 1 and do +1 for each tx set within a single group.)