Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor TxEventQ Stream Binder #111

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mvn integration-test
To use in an application project, add the following dependencies apart from regular spring-cloud-stream project dependencies:
```
<dependency>
<groupId>com.oracle.database.cstream</groupId>
<groupId>com.oracle.database.spring.cloud.stream.binder</groupId>
<artifactId>spring-cloud-stream-binder-oracle-txeventq</artifactId>
<version>0.9.0</version>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.oracle.database.cstream</groupId>
<groupId>com.oracle.database.spring.cloud.stream.binder</groupId>
<artifactId>spring-cloud-stream-binder-oracle-txeventq</artifactId>
<version>0.9.0</version>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.oracle.cstream;
package com.oracle.database.spring.cloud.stream.binder;

import java.util.function.Consumer;
import java.util.function.Supplier;
Expand All @@ -11,7 +11,7 @@
public class MultipleConsumerTest {
int y = 0;
public static void main(String[] args) {
SpringApplication.run(MultipleConsumerTest.class,
SpringApplication.run(MultipleConsumerTest.class,
"--spring.datasource.url=jdbc:oracle:thin:@cdb1_pdb1_wallet",
"--spring.datasource.oracleucp.connection-properties.oracle.net.wallet_location=C:/tmp/wallet",
"--spring.datasource.oracleucp.connection-properties.oracle.net.tns_admin=C:/tmp/wallet",
Expand All @@ -27,19 +27,19 @@ public static void main(String[] args) {
// "--spring.cloud.stream.bindings.pd-out-0.producer.requiredGroups=t1",
// "--spring.cloud.stream.bindings.pd-out-0.producer.poller.fixedDelay=100"); /**/
}


@Bean
public Consumer<String> cs1() {
return to -> System.out.println("Received for cs1: " + to);
}

@Bean
public Consumer<String> cs2() {
return to -> System.out.println("Received for cs2: " + to);
}


// @Bean
// public Supplier<String> pd() {
// return () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ echo "Successfully deployed project to ${REPOSITORY_URL}/${REPOSITORY_NAME}"
PACKAGES="$(mvn -Dexec.executable='echo' -Dexec.args='${project.artifactId}' exec:exec -q)"
printf "The following artifacts have been created for upload:\n\n"
for PACKAGE in $PACKAGES; do
echo "com.oracle.cloud.spring:${PACKAGE}:${VERSION}"
echo "com.oracle.database.spring.cloud.stream.binder:${PACKAGE}:${VERSION}"
done
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Spring Cloud Stream exposes a [functional messaging API](https://docs.spring.io/

### WordSupplier: Message Producer

The [WordSupplier](src/main/java/com/oracle/cstream/sample/WordSupplier.java) class produces a series of words to a topic. Consumers may subscribe to this topic to review messages from the supplier.
The [WordSupplier](src/main/java/com/oracle/database/spring/cloud/stream/binder/sample/WordSupplier.java) class produces a series of words to a topic. Consumers may subscribe to this topic to review messages from the supplier.

### toUpperCase and stdoutConsumer

Messages from the WordSupplier are piped through the [toUpperCase](src/main/java/com/oracle/cstream/sample/StreamConfiguration.java) functional interface to demonstrate stream processing. Finally, each message is consumed and printed to stdout by the `stdoutConsumer`.
Messages from the WordSupplier are piped through the [toUpperCase](src/main/java/com/oracle/database/spring/cloud/stream/binder/sample/StreamConfiguration.java) functional interface to demonstrate stream processing. Finally, each message is consumed and printed to stdout by the `stdoutConsumer`.

### Running the tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Copyright (c) 2024, Oracle and/or its affiliates. -->
<!-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.oracle.database.cstream</groupId>
<groupId>com.oracle.database.spring.cloud.stream.binder</groupId>
<artifactId>spring-cloud-stream-binder-txeventq-sample</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
Expand Down Expand Up @@ -52,7 +52,7 @@

<dependencies>
<dependency>
<groupId>com.oracle.database.cstream</groupId>
<groupId>com.oracle.database.spring.cloud.stream.binder</groupId>
<artifactId>spring-cloud-stream-binder-oracle-txeventq</artifactId>
<version>${txeventq.streambinder.version}</version>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2024, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
package com.oracle.cstream.sample;
package com.oracle.database.spring.cloud.stream.binder.sample;

import java.util.function.Consumer;
import java.util.function.Function;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2024, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
package com.oracle.cstream.sample;
package com.oracle.database.spring.cloud.stream.binder.sample;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.oracle.cstream.sample;
package com.oracle.database.spring.cloud.stream.binder.sample;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2024, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
package com.oracle.cstream.sample;
package com.oracle.database.spring.cloud.stream.binder.sample;

import java.time.Duration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@
* limitations under the License.
*/

package com.oracle.cstream;
package com.oracle.database.spring.cloud.stream.binder;

import com.oracle.cstream.config.*;
import com.oracle.cstream.provisioning.JmsConsumerDestination;
import com.oracle.cstream.provisioning.JmsProducerDestination;
import com.oracle.cstream.utils.*;
import com.oracle.database.spring.cloud.stream.binder.config.JmsConsumerProperties;
import com.oracle.database.spring.cloud.stream.binder.config.JmsExtendedBindingProperties;
import com.oracle.database.spring.cloud.stream.binder.config.JmsProducerProperties;
import com.oracle.database.spring.cloud.stream.binder.provisioning.JmsConsumerDestination;
import com.oracle.database.spring.cloud.stream.binder.provisioning.JmsProducerDestination;


import com.oracle.database.spring.cloud.stream.binder.utils.DestinationNameResolver;
import com.oracle.database.spring.cloud.stream.binder.utils.JmsMessageDrivenChannelAdapterFactory;
import com.oracle.database.spring.cloud.stream.binder.utils.JmsSendingMessageHandlerFactory;
import jakarta.jms.Connection;
import jakarta.jms.ConnectionFactory;
import jakarta.jms.Session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
* limitations under the License.
*/

package com.oracle.cstream;
package com.oracle.database.spring.cloud.stream.binder;

import com.oracle.cstream.config.JmsConsumerProperties;
import com.oracle.cstream.config.JmsProducerProperties;
import com.oracle.cstream.plsql.OracleDBUtils;
import com.oracle.cstream.provisioning.JmsConsumerDestination;
import com.oracle.cstream.provisioning.JmsProducerDestination;
import com.oracle.database.spring.cloud.stream.binder.config.JmsConsumerProperties;
import com.oracle.database.spring.cloud.stream.binder.config.JmsProducerProperties;
import com.oracle.database.spring.cloud.stream.binder.plsql.OracleDBUtils;
import com.oracle.database.spring.cloud.stream.binder.provisioning.JmsConsumerDestination;
import com.oracle.database.spring.cloud.stream.binder.provisioning.JmsProducerDestination;
import jakarta.jms.Connection;
import jakarta.jms.ConnectionFactory;
import jakarta.jms.JMSException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* limitations under the License.
*/

package com.oracle.cstream.config;
package com.oracle.database.spring.cloud.stream.binder.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.stream.binder.Binder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@
* limitations under the License.
*/

package com.oracle.cstream.config;

import com.oracle.cstream.JMSMessageChannelBinder;
import com.oracle.cstream.utils.*;
package com.oracle.database.spring.cloud.stream.binder.config;

import com.oracle.database.spring.cloud.stream.binder.JMSMessageChannelBinder;
import com.oracle.database.spring.cloud.stream.binder.utils.Base64UrlNamingStrategy;
import com.oracle.database.spring.cloud.stream.binder.utils.DestinationNameResolver;
import com.oracle.database.spring.cloud.stream.binder.utils.JmsMessageDrivenChannelAdapterFactory;
import com.oracle.database.spring.cloud.stream.binder.utils.JmsSendingMessageHandlerFactory;
import com.oracle.database.spring.cloud.stream.binder.utils.ListenerContainerFactory;
import com.oracle.database.spring.cloud.stream.binder.utils.MessageRecoverer;
import com.oracle.database.spring.cloud.stream.binder.utils.RepublishMessageRecoverer;
import com.oracle.database.spring.cloud.stream.binder.utils.SpecCompliantJmsHeaderMapper;
import jakarta.jms.ConnectionFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.config;
package com.oracle.database.spring.cloud.stream.binder.config;

import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.config;
package com.oracle.database.spring.cloud.stream.binder.config;

public class JmsConsumerProperties {
private static final String DEFAULT_DLQ_NAME = "Spring_Cloud_Stream_dlq";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.config;
package com.oracle.database.spring.cloud.stream.binder.config;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.config;
package com.oracle.database.spring.cloud.stream.binder.config;

public class JmsProducerProperties {
private String serializer = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
* limitations under the License.
*/

package com.oracle.cstream.config;
package com.oracle.database.spring.cloud.stream.binder.config;

import com.oracle.cstream.TxEventQQueueProvisioner;
import com.oracle.cstream.plsql.OracleDBUtils;
import com.oracle.database.spring.cloud.stream.binder.TxEventQQueueProvisioner;
import com.oracle.database.spring.cloud.stream.binder.plsql.OracleDBUtils;

import jakarta.jms.ConnectionFactory;
import jakarta.jms.JMSException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.plsql;
package com.oracle.database.spring.cloud.stream.binder.plsql;

import java.sql.CallableStatement;
import java.sql.Connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.provisioning;
package com.oracle.database.spring.cloud.stream.binder.provisioning;

import org.springframework.cloud.stream.provisioning.ConsumerDestination;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.provisioning;
package com.oracle.database.spring.cloud.stream.binder.provisioning;

import jakarta.jms.JMSException;
import jakarta.jms.Topic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.serialize;
package com.oracle.database.spring.cloud.stream.binder.serialize;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -66,8 +66,8 @@ public Object fromMessage(Message jmsMessage) throws JMSException {
}

if (!isInstanceOfDeserializer) {
logger.debug("The configured deserializer class is not an instance of 'com.oracle.cstream.serialize.DeSerializer'");
throw new IllegalArgumentException("The configured serializer class is not an instance of 'com.oracle.cstream.serialize.DeSerializer'");
logger.debug("The configured deserializer class is not an instance of 'com.oracle.database.spring.cloud.stream.binder.serialize.DeSerializer'");
throw new IllegalArgumentException("The configured serializer class is not an instance of 'com.oracle.database.spring.cloud.stream.binder.serialize.DeSerializer'");
}

Deserializer<?> s = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.serialize;
package com.oracle.database.spring.cloud.stream.binder.serialize;

public interface Deserializer<T> {
T deserialize(byte[] bytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.serialize;
package com.oracle.database.spring.cloud.stream.binder.serialize;

public interface Serializer {
byte[] serialize(Object data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.utils;
package com.oracle.database.spring.cloud.stream.binder.utils;

public interface AnonymousNamingStrategy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.utils;
package com.oracle.database.spring.cloud.stream.binder.utils;

import java.nio.ByteBuffer;
import java.util.Base64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.utils;
package com.oracle.database.spring.cloud.stream.binder.utils;

import org.springframework.util.StringUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.utils;
package com.oracle.database.spring.cloud.stream.binder.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
* limitations under the License.
*/

package com.oracle.cstream.utils;
package com.oracle.database.spring.cloud.stream.binder.utils;

import com.oracle.cstream.config.JmsConsumerProperties;
import com.oracle.cstream.serialize.CustomSerializationMessageConverter;
import com.oracle.database.spring.cloud.stream.binder.config.JmsConsumerProperties;
import com.oracle.database.spring.cloud.stream.binder.serialize.CustomSerializationMessageConverter;

import jakarta.jms.BytesMessage;
import jakarta.jms.Destination;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.utils;
package com.oracle.database.spring.cloud.stream.binder.utils;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.utils;
package com.oracle.database.spring.cloud.stream.binder.utils;

import jakarta.jms.ConnectionFactory;
import jakarta.jms.Destination;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* limitations under the License.
*/

package com.oracle.cstream.utils;
package com.oracle.database.spring.cloud.stream.binder.utils;

import jakarta.jms.Message;

Expand Down
Loading
Loading