Run apply-object before the ref-updated stream event

The pull-replication plugin's promise is to run apply-object
to replicate the refs in msec, so that the overall end-to-end
operation runs synchronously. However, the ref-updated was
executed before the apply-object, leaving room for the event
consumer to potentially fail when looking at the ref value because
the apply-object may have completed or not.

Use the same EventListener interface used in the stream-event
listeners for making sure that apply-object is always executed
before ref-updated.

Also amend the test environment for the broker scenario for
including the apply-object use-case as well, where the events
broker is used as fallback by putting the events-kafka plugin
to the bottom of the plugin loading priority.

Change-Id: If96082f4338164e1674bae657ab4184577d825f2
9 files changed