jdbc - blocking consumers in apache camel using existing components -


i use apache camel jdbc component read oracle table. want camel run in distributed environment meet availability concerns. however, table reading similar queue, want have single reader @ given time can avoid locking issues (messy in oracle).

if reader goes down, want reader take over.

how accomplish using out-of-the-box camel components? possible?

it depends on deployment architecture. example, if deploy camel apps on servicemix (or activemq) in master/slave configuration (for ha), 1 consumer active @ given time...

but, if need multiple running (clustered scalability), (by default) compete/duplicate reads table unless write own locking logic.

this easy using hazelcast distributed locking. there camel-hazelcast component, doesn't support lock api. once configure apps participate in hazelcast cluster, just lock api around code need synchronize given object...

import com.hazelcast.core.hazelcast; import java.util.concurrent.locks.lock;  lock lock = hazelcast.getlock(mylockedobject); lock.lock(); try {     // here } {     lock.unlock(); }  

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -