Class DefaultBinding<T>
java.lang.Object
org.springframework.cloud.stream.binder.DefaultBinding<T>
- Type Parameters:
T- type of binding
- All Implemented Interfaces:
Binding<T>,org.springframework.context.Lifecycle,org.springframework.integration.core.Pausable,org.springframework.integration.support.management.ManageableLifecycle
Default implementation for a
Binding.- Author:
- Jennifer Hickey, Mark Fisher, Gary Russell, Marius Bogoevici, Oleg Zhurakousky, Myeonghyeon Lee, Soby Chacko
- See Also:
-
org.springframework.cloud.stream.annotation.EnableBinding
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultBinding(String name, String group, T target, org.springframework.context.Lifecycle lifecycle) Creates an instance that associates a given name, group and binding target with an optionalLifecyclecomponent, which will be stopped during unbinding.DefaultBinding(String name, T target, org.springframework.context.Lifecycle lifecycle) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidListener method that executes after unbinding.Returns the name of the target for this binding (i.e., channel name).getGroup()getName()Returns the name of the destination for this binding.getState()booleanbooleanisPaused()Will always return false unless overriden.booleanvoidpause()Pauses the target component represented by this instance if and only if the component implementsPausableinterface NOTE: At the time the instance is created the component is already started and active.voidresume()Resumes the target component represented by this instance if and only if the component implementsPausableinterface NOTE: At the time the instance is created the component is already started and active.voidsetCompanion(org.springframework.context.Lifecycle companion) Sets the companion Lifecycle.voidstart()Starts the target component represented by this instance.voidstop()Stops the target component represented by this instance.toString()voidunbind()Unbinds the target component represented by this instance and stops any active components.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.cloud.stream.binder.Binding
getExtendedInfo, isInput
-
Field Details
-
name
-
group
-
target
-
lifecycle
protected final org.springframework.context.Lifecycle lifecycle
-
-
Constructor Details
-
DefaultBinding
public DefaultBinding(String name, String group, T target, org.springframework.context.Lifecycle lifecycle) Creates an instance that associates a given name, group and binding target with an optionalLifecyclecomponent, which will be stopped during unbinding.- Parameters:
name- the name of the binding targetgroup- the group (only for input targets)target- the binding targetlifecycle-Lifecyclethat runs while the binding is active and will be stopped during unbinding
-
DefaultBinding
-
-
Method Details
-
getName
Description copied from interface:BindingReturns the name of the destination for this binding. -
getBindingName
Description copied from interface:BindingReturns the name of the target for this binding (i.e., channel name).- Specified by:
getBindingNamein interfaceBinding<T>- Returns:
- binding name
-
getGroup
-
getState
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceBinding<T>- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle- Specified by:
isRunningin interfaceorg.springframework.integration.support.management.ManageableLifecycle- Returns:
- 'true' if the target component represented by this instance is running.
-
isPausable
public boolean isPausable() -
isPaused
public boolean isPaused()Description copied from interface:BindingWill always return false unless overriden. -
start
public void start()Description copied from interface:BindingStarts the target component represented by this instance. NOTE: At the time the instance is created the component is already started. This operation is typically used by actuator to re-bind/re-start. -
stop
public void stop()Description copied from interface:BindingStops the target component represented by this instance. NOTE: At the time the instance is created the component is already started. This operation is typically used by actuator to re-bind/re-start. -
pause
public void pause()Description copied from interface:BindingPauses the target component represented by this instance if and only if the component implementsPausableinterface NOTE: At the time the instance is created the component is already started and active. This operation is typically used by actuator to pause/resume. -
resume
public void resume()Description copied from interface:BindingResumes the target component represented by this instance if and only if the component implementsPausableinterface NOTE: At the time the instance is created the component is already started and active. This operation is typically used by actuator to pause/resume. -
unbind
public void unbind()Description copied from interface:BindingUnbinds the target component represented by this instance and stops any active components. Implementations must be idempotent. After this method is invoked, the target is not expected to receive any messages; this instance should be discarded, and a new Binding should be created instead. -
toString
-
afterUnbind
protected void afterUnbind()Listener method that executes after unbinding. Subclasses can implement their own behaviour on unbinding by overriding this method. -
setCompanion
public void setCompanion(org.springframework.context.Lifecycle companion) Sets the companion Lifecycle. In most cases, when dealing with message producer (e.g., Supplier), performing any lifecycle operation on it does nothing as we may need to also perform the same operation on its companion object (e.g., SourcePollingChannelAdapter)- Parameters:
companion- instance of companionLifecycleobject
-