Class InspectableProducer<T>
- java.lang.Object
-
- org.ikasan.component.endpoint.jms.spring.producer.JmsTemplateProducer<T>
-
- org.ikasan.testharness.flow.producer.InspectableProducer<T>
-
- All Implemented Interfaces:
org.ikasan.spec.component.endpoint.Producer<T>,org.ikasan.spec.configuration.Configured<org.ikasan.component.endpoint.jms.spring.producer.SpringMessageProducerConfiguration>,org.ikasan.spec.configuration.ConfiguredResource<org.ikasan.component.endpoint.jms.spring.producer.SpringMessageProducerConfiguration>,org.ikasan.spec.management.ManagedResource
public class InspectableProducer<T> extends org.ikasan.component.endpoint.jms.spring.producer.JmsTemplateProducer<T>Dummy producer to test last messages/events in unit tests.It can be used with or without an actual
IkasanJmsTemplatesetup. If you want to use it with aIkasanJmsTemplatesimple provide the instance of the template in constructor (directly or in Spring config) and provide "configuration" and "configuredResourceId" parameters.Useful for unit tests by providing a Spring config that will override the original producer with this implementation, so that you can check the persisted messages by calling the
getEvents()andgetEventCount()methods.- Author:
- Ikasan Development Team
-
-
Constructor Summary
Constructors Constructor Description InspectableProducer()Constructs a InspectableProducer.InspectableProducer(org.springframework.jms.core.IkasanJmsTemplate jmsTemplate)Constructs a InspectableProducer with anIkasanJmsTemplate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetEventCount()java.util.List<T>getEvents()voidinvoke(T message)booleanisUseJms()voidsetUseJms(boolean useJms)-
Methods inherited from class org.ikasan.component.endpoint.jms.spring.producer.JmsTemplateProducer
establishConnectionFactory, getConfiguration, getConfiguredResourceId, isCriticalOnStartup, setConfiguration, setConfiguredResourceId, setCriticalOnStartup, setManagedResourceRecoveryManager, startManagedResource, stopManagedResource
-
-
-
-
Constructor Detail
-
InspectableProducer
public InspectableProducer()
Constructs a InspectableProducer. All messages that the producer processes will be collected and not processed further.
-
InspectableProducer
public InspectableProducer(org.springframework.jms.core.IkasanJmsTemplate jmsTemplate)
Constructs a InspectableProducer with anIkasanJmsTemplate. All messages that the producer processes will be collected and also send via the jms template.- Parameters:
jmsTemplate-
-
-
Method Detail
-
isUseJms
public boolean isUseJms()
- Returns:
- the value of the useJms property.
-
setUseJms
public void setUseJms(boolean useJms)
- Parameters:
useJms- configuration if the messages are processed via Jms after collection.
-
getEventCount
public int getEventCount()
- Returns:
- the count of the currently collected events.
-
getEvents
public java.util.List<T> getEvents()
- Returns:
- the events that the producer processed
-
invoke
public void invoke(T message) throws org.ikasan.spec.component.endpoint.EndpointException
-
-