Merge pull request #45 from dturanski/INT-2075

made changes for the new SGF class names
This commit is contained in:
Mark Fisher
2011-08-27 12:42:58 -04:00
6 changed files with 26 additions and 28 deletions

View File

@@ -55,8 +55,8 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/gemfire
<title>Continuous Query Inbound Channel Adapter</title>
<para>
The <emphasis>cq-inbound-channel-adapter</emphasis> produces messages a channel triggered by a GemFire continuous query or <classname>CqEvent</classname> event. Spring GemFire introduced
continuous query support in release 1.1, including a <classname>QueryListenerContainer</classname> which provides a nice abstraction over the GemFire native API. This adapter requires a
reference to a QueryListenerContainer, and creates a listener for a given <code>query</code> and executes the query. The continuous query acts as an event source that will fire whenever its
continuous query support in release 1.1, including a <classname>ContinuousQueryListenerContainer</classname> which provides a nice abstraction over the GemFire native API. This adapter requires a
reference to a ContinuousQueryListenerContainer, and creates a listener for a given <code>query</code> and executes the query. The continuous query acts as an event source that will fire whenever its
result set changes state.
<note>
GemFire queries are written in OQL and are scoped to the entire cache (not just one region). Additionally, continuous queries require a remote (i.e., running in a separate process or remote host)
@@ -74,20 +74,18 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/gemfire
<gfe:client-region id="test" cache-ref="client-cache" pool-name="client-pool"/>
<bean id="queryListenerContainer"
class="org.springframework.data.gemfire.listener.QueryListenerContainer">
<property name="cache" ref="client-cache"/>
</bean>
<gfe:cq-listener-container id="queryListenerContainer" cache="client-cache"
pool-name="client-pool"/>
<int-gfe:cq-inbound-channel-adapter id="inputChannel"
query-listener-container="queryListenerContainer"
cq-listener-container="queryListenerContainer"
query="select * from /test"/>
]]>
</programlisting>
In the above configuration, we are creating a GemFire client cache
(recall a cache server is required for this implementation and its address is configured as a sub-element of the pool), a client region and a <classname>QueryListenerContainer</classname>
using Spring GemFire. The continuous query inbound channel adapter requires a <code>query-listener-container</code> attribute which contains a reference to the <classname>QueryListenerContainer</classname>. Optionally,
(recall a cache server is required for this implementation and its address is configured as a sub-element of the pool), a client region and a <classname>ContinuousQueryListenerContainer</classname>
using Spring GemFire. The continuous query inbound channel adapter requires a <code>cq-listener-container</code> attribute which contains a reference to the <classname>ContinuousQueryListenerContainer</classname>. Optionally,
it accepts an <code>expression</code> attribute which uses SpEL to transform the <code>CqEvent</code> or extract an individual property as needed. The cq-inbound-channel-adapter provides a
<code>query-events</code> attribute, containing a comma separated list of event types for which a message will be produced on the input channel. Available event types are CREATED, UPDATED, DESTROYED,
REGION_DESTROYED, REGION_INVALIDATED. CREATED and UPDATED are enabled by default. Additional optional attributes include, <code>query-name</code> which provides an optional query name, and

View File

@@ -32,7 +32,7 @@ public class GemfireCqInboundChannelAdapterParser extends AbstractChannelAdapter
private static final String OUTPUT_CHANNEL_PROPERTY = "outputChannel";
private static final String QUERY_LISTENER_CONTAINER_ATTRIBUTE = "query-listener-container";
private static final String QUERY_LISTENER_CONTAINER_ATTRIBUTE = "cq-listener-container";
private static final String DURABLE_ATTRIBUTE = "durable";

View File

@@ -22,9 +22,9 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.data.gemfire.listener.CqQueryDefinition;
import org.springframework.data.gemfire.listener.QueryListener;
import org.springframework.data.gemfire.listener.QueryListenerContainer;
import org.springframework.data.gemfire.listener.ContinuousQueryDefinition;
import org.springframework.data.gemfire.listener.ContinuousQueryListener;
import org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer;
import org.springframework.integration.Message;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.util.Assert;
@@ -42,12 +42,12 @@ import com.gemstone.gemfire.cache.query.CqEvent;
* @since 2.1
*
*/
public class ContinuousQueryMessageProducer extends SpelMessageProducerSupport implements QueryListener {
public class ContinuousQueryMessageProducer extends SpelMessageProducerSupport implements ContinuousQueryListener {
private static Log logger = LogFactory.getLog(ContinuousQueryMessageProducer.class);
private final String query;
private final QueryListenerContainer queryListenerContainer;
private final ContinuousQueryListenerContainer queryListenerContainer;
private volatile String queryName;
@@ -62,7 +62,7 @@ public class ContinuousQueryMessageProducer extends SpelMessageProducerSupport i
* {@link org.springframework.data.gemfire.listener.QueryListenerContainer}
* @param query the query string
*/
public ContinuousQueryMessageProducer(QueryListenerContainer queryListenerContainer, String query) {
public ContinuousQueryMessageProducer(ContinuousQueryListenerContainer queryListenerContainer, String query) {
Assert.notNull(queryListenerContainer, "'queryListenerContainer' cannot be null");
Assert.notNull(query, "'query' cannot be null");
this.queryListenerContainer = queryListenerContainer;
@@ -94,10 +94,10 @@ public class ContinuousQueryMessageProducer extends SpelMessageProducerSupport i
protected void onInit() {
super.onInit();
if (queryName == null) {
queryListenerContainer.addListener(new CqQueryDefinition(this.query, this, this.durable));
queryListenerContainer.addListener(new ContinuousQueryDefinition(this.query, this, this.durable));
}
else {
queryListenerContainer.addListener(new CqQueryDefinition(this.queryName, this.query, this, this.durable));
queryListenerContainer.addListener(new ContinuousQueryDefinition(this.queryName, this.query, this, this.durable));
}
}

View File

@@ -69,15 +69,15 @@
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="InboundChannelAdapterType">
<xsd:attribute name="query-listener-container" use="required">
<xsd:attribute name="cq-listener-container" use="required">
<xsd:annotation>
<xsd:documentation><![CDATA[
Reference to a QueryListenerContainer
Reference to a ContinuousQueryListenerContainer
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="value">
<tool:expected-type
type="org.springframework.data.gemfire.listener.QueryListenerContainer" />
type="org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>

View File

@@ -17,7 +17,7 @@ import static org.mockito.Mockito.mock;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.gemfire.listener.QueryListenerContainer;
import org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer;
import org.springframework.integration.Message;
import org.springframework.integration.MessagingException;
import org.springframework.integration.channel.DirectChannel;
@@ -33,7 +33,7 @@ import com.gemstone.gemfire.cache.query.internal.CqQueryImpl;
* @since 2.1
*/
public class ContinuousQueryMessageProducerTests {
QueryListenerContainer queryListenerContainer;
ContinuousQueryListenerContainer queryListenerContainer;
ContinuousQueryMessageProducer cqMessageProducer;
@@ -41,7 +41,7 @@ public class ContinuousQueryMessageProducerTests {
@Before
public void setUp() {
queryListenerContainer = mock(QueryListenerContainer.class);
queryListenerContainer = mock(ContinuousQueryListenerContainer.class);
cqMessageProducer = new ContinuousQueryMessageProducer(queryListenerContainer, "");
DirectChannel outputChannel = new DirectChannel();
cqMessageProducer.setOutputChannel(outputChannel);

View File

@@ -19,18 +19,18 @@
<gfe:client-region id="test" cache-ref="client-cache" pool-name="client-pool" data-policy="EMPTY"/>
<bean id="queryListenerContainer" class="org.springframework.data.gemfire.listener.QueryListenerContainer">
<bean id="queryListenerContainer" class="org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer">
<property name="cache" ref="client-cache"/>
</bean>
<int-gfe:cq-inbound-channel-adapter query-listener-container="queryListenerContainer"
<int-gfe:cq-inbound-channel-adapter cq-listener-container="queryListenerContainer"
query="select * from /test" channel="outputChannel1" durable="true"/>
<int:channel id="outputChannel1">
<int:queue/>
</int:channel>
<int-gfe:cq-inbound-channel-adapter query-listener-container="queryListenerContainer"
<int-gfe:cq-inbound-channel-adapter cq-listener-container="queryListenerContainer"
query="select * from /test" channel="outputChannel2" expression="newValue" query-events="CREATED"/>