1

I am running into a unique problem. We have an app where we process volume of data and then put them in DB in the order in which its received.

enter image description here

Problem happens when the TX# goes above 99999 and rows go above 9999.

Also we are limited to to this seq no# for 9 digits only and not able to go beyond that due to the way is system designed initially sometime back.

Whats the best way for us to make this seq number, so that we will not loose the order of the records we get?

rajcool111
  • 657
  • 4
  • 14
  • 36

1 Answers1

1

It seems that you are dealing with infinite sequences. Right now the bottleneck is 99999. But as and how the application grows, you might hit the upper bottleneck of 9999999999. Hence in such a case it is ideal to use Streams in scala which are lazy and equivalent to lists.

Please refer https://alvinalexander.com/scala/how-to-use-stream-class-lazy-list-scala-cookbook to understand more about scala streams. Also you could also use an Iterator in place of streams. Please refer https://stackoverflow.com/a/6408804/7803797 for further information.

I hope this helps.

Chaitanya
  • 3,590
  • 14
  • 33
  • @rajcool111 Please accept the answer if it answers your question, else let me know if you have any further doubts – Chaitanya Mar 28 '19 at 19:13
  • surely will do. Just waiting little more to get few more answers and see what works best! but, appreciate your help. – rajcool111 Mar 28 '19 at 20:58