lib/trailblazer/operation/public_call.rb in trailblazer-operation-0.5.2 vs lib/trailblazer/operation/public_call.rb in trailblazer-operation-0.5.3
- old
+ new
@@ -11,25 +11,25 @@
# get removed in future versions of TRB. Currently, we use Operation::__call__ as an alternative.
#
#
# @note Do not override this method as it will be removed in future versions. Also, you will break tracing.
# @return Operation::Railway::Result binary result object
- def call(*args)
- return call_with_circuit_interface(*args) if args.any? && args[0].is_a?(Array) # This is kind of a hack that could be well hidden if Ruby had method overloading. Goal is to simplify the call/__call__ thing as we're fading out Operation::call anyway.
+ def call(options = {}, *args)
+ return call_with_circuit_interface(options, *args) if options.is_a?(Array) # This is kind of a hack that could be well hidden if Ruby had method overloading. Goal is to simplify the call/__call__ thing as we're fading out Operation::call anyway.
- call_with_public_interface(*args)
+ call_with_public_interface(options, *args)
end
def call_with_public_interface(*args)
- ctx = options_for_public_call(*args)
+ ctx = options_for_public_call(*args, flow_options())
# call the activity.
# This will result in invoking {::call_with_circuit_interface}.
# last_signal, (options, flow_options) = Activity::TaskWrap.invoke(self, [ctx, {}], {})
signal, (ctx, flow_options) = Activity::TaskWrap.invoke(
@activity,
- [ctx, {}],
+ [ctx, flow_options()],
exec_context: new
)
# Result is successful if the activity ended with an End event derived from Railway::End::Success.
Operation::Railway::Result(signal, ctx, flow_options)
@@ -44,10 +44,15 @@
Operation::PublicCall.options_for_public_call(*args)
end
# Compile a Context object to be passed into the Activity::call.
# @private
- def self.options_for_public_call(options={})
- Trailblazer::Context.for(options, [options, {}], {})
+ def self.options_for_public_call(options, **flow_options)
+ Trailblazer::Context.for_circuit(options, {}, [options, flow_options], {})
+ end
+
+ # @semi=public
+ def flow_options
+ {context_alias: {}}
end
end
end