Skip to content
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
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2023, Oracle and/or its affiliates. -->
<!-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. -->
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>aqjms-jakarta-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>aqjms-jakarta-sample</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>

<dependencies>
<dependency>
<groupId>com.oracle.database.spring</groupId>
<artifactId>oracle-spring-boot-starter-aqjms</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2023, 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.example.aqjms;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@ToString
public class Email {
private String to;
private String body;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (c) 2023, 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.example.aqjms;

import jakarta.jms.ConnectionFactory;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.config.JmsListenerContainerFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.support.converter.MappingJackson2MessageConverter;
import org.springframework.jms.support.converter.MessageConverter;
import org.springframework.jms.support.converter.MessageType;

@SpringBootApplication
@EnableJms
public class JmsSampleApplication {

@Bean
public JmsListenerContainerFactory<?> myFactory(ConnectionFactory connectionFactory,
DefaultJmsListenerContainerFactoryConfigurer configurer) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
// This provides all boot's default to this factory, including the message converter
configurer.configure(factory, connectionFactory);
// You could still override some of Boot's default if necessary.
return factory;
}

@Bean // Serialize message content to json using TextMessage
public MessageConverter jacksonJmsMessageConverter() {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}

public static void main(String[] args) {
// Launch the application
ConfigurableApplicationContext context = SpringApplication.run(JmsSampleApplication.class, args);

JmsTemplate jmsTemplate = context.getBean(JmsTemplate.class);

// Send a message with a POJO - the template reuse the message converter
System.out.println("Sending an email message.");
jmsTemplate.convertAndSend("mailbox", new Email("[email protected]", "Hello"));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2023, 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.example.aqjms;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

@Component
public class Receiver {
@JmsListener(destination = "mailbox", containerFactory = "myFactory")
public void receiveMessage(Email email) {
System.out.println("Received <" + email + ">");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

oracle.aq.username=pdbadmin
oracle.aq.password=Welcome123
oracle.aq.url=jdbc:oracle:thin:@//172.17.0.2:1521/pdb1
oracle.aq.queue=mailbox
1 change: 1 addition & 0 deletions developer-preview/mbaas-developer-preview/sample-spring-apps/pom.xml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<module>bankb</module>
<module>slow_service</module>
<module>aqjms_sample</module>
<module>aqjms-jakarta_sample</module>
</modules>

<name>sample-spring-apps</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Oracle Free Use Terms and Conditions

Definitions

"Oracle" refers to Oracle America, Inc. "You" and "Your" refers to (a) a company or organization (each an "Entity")
accessing the Programs, if use of the Programs will be on behalf of such Entity; or (b) an individual accessing the
Programs, if use of the Programs will not be on behalf of an Entity. "Program(s)" refers to Oracle software provided
by Oracle pursuant to the following terms and any updates, error corrections, and/or Program Documentation provided
by Oracle. "Program Documentation" refers to Program user manuals and Program installation manuals, if any.
If available, Program Documentation may be delivered with the Programs and/or may be accessed from
www.oracle.com/documentation.
"Separate Terms" refers to separate license terms that are specified in the Program Documentation, readmes or notice
files and that apply to Separately Licensed Technology. "Separately Licensed Technology" refers to Oracle or third
party technology that is licensed under Separate Terms and not under the terms of this license.

Separately Licensed Technology

Oracle may provide certain notices to You in Program Documentation, readmes or notice files in connection with Oracle
or third party technology provided as or with the Programs. If specified in the Program Documentation, readmes or
notice files, such technology will be licensed to You under Separate Terms. Your rights to use Separately Licensed
Technology under Separate Terms are not restricted in any way by the terms herein. For clarity, notwithstanding
the existence of a notice, third party technology that is not Separately Licensed Technology shall be deemed part
of the Programs licensed to You under the terms of this license.

Source Code for Open Source Software

For software that You receive from Oracle in binary form that is licensed under an open source license that gives
You the right to receive the source code for that binary, You can obtain a copy of the applicable source code from
https://oss.oracle.com/sources/ or http://www.oracle.com/goto/opensourcecode. If the source code for such software
was not provided to You with the binary, You can also receive a copy of the source code on physical media by
submitting a written request pursuant to the instructions in the "Written Offer for Source Code" section of the
latter website.

-------------------------------------------------------------------------------

The following license terms apply to those Programs that are not provided to You under Separate Terms.

License Rights and Restrictions

Oracle grants to You, as a recipient of this Program, a nonexclusive, nontransferable, limited license to, subject
to the conditions stated herein, (a) internally use the unmodified Programs for the purposes of developing, testing,
prototyping and demonstrating your applications, and running the Programs for your own internal business operations;
and (b) redistribute unmodified Programs and Programs Documentation, under the terms of this License, provided that
You do not charge Your end users any additional fees for the use of the Programs. You may make copies of the Programs
to the extent reasonably necessary for exercising the license rights granted herein and for backup purposes. You are
granted the right to use the Programs to provide third party training in the use of the Programs and associated
Separately Licensed Technology only if there is express authorization of such use by Oracle on the Program's download
page or in the Program Documentation.

Your license is contingent on Your compliance with the following conditions:

- You include a copy of this license with any distribution by You of the Programs;

- You do not remove markings or notices of either Oracle's or a licensor's proprietary rights from the Programs or
Program Documentation;

- You comply with all U.S. and applicable export control and economic sanctions laws and regulations that govern
Your use of the Programs (including technical data);

- You do not cause or permit reverse engineering, disassembly or decompilation of the Programs (except as allowed by law)
by You nor allow an associated party to do so.

For clarity, any source code that may be included in the distribution with the Programs is provided solely for reference
purposes and may not be modified, unless such source code is under Separate Terms permitting modification.

Ownership

Oracle or its licensors retain all ownership and intellectual property rights to the Programs.

Information Collection

The Programs' installation and/or auto-update processes, if any, may transmit a limited amount of data to Oracle
or its service provider about those processes to help Oracle understand and optimize them. Oracle does not associate
the data with personally identifiable information. Refer to Oracle's Privacy Policy at www.oracle.com/privacy.

Disclaimer of Warranties; Limitation of Liability

THE PROGRAMS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ORACLE FURTHER DISCLAIMS ALL WARRANTIES,
EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
A PARTICULAR PURPOSE, OR NONINFRINGEMENT.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL ORACLE BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING
BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Last updated: 9 October 2018
Loading