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 azure-message-queue rule and add spring amqp & rabbit #250

Merged
merged 8 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions rules-catalogue/rules-catalogue.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
| azure-java-version-02000 | Java version found to be lower than JAVA_8 | mandatory | 3 | X | X | X | X | azure-java-version.windup.xml |
| azure-keystore-certificates-01000 | Java KeyStore file found | potential | 3 | X | X | X | X | azure-keystore-certificates.windup.xml |
| azure-keystore-certificates-02000 | The application loads certificates into a KeyStore | potential | 3 | X | X | X | X | azure-keystore-certificates.windup.xml |
| azure-mq-config-kafka-01000 | Kafka connection string, username or password found in configuration file | information | 0 | X | X | X | X | azure-mq-config.windup.xml |
KaiqianYang marked this conversation as resolved.
Show resolved Hide resolved
| azure-mq-config-rabbitmq-01000 | RabbitMQ connection string, username or password found in configuration file | information | 0 | X | X | X | X | azure-mq-config.windup.xml |
| azure-mq-config-artemis-01000 | ActiveMQ Artemis connection string, username or password found in configuration file | information | 0 | X | X | X | X | azure-mq-config.windup.xml |
| azure-message-queue-config-kafka-01000 | Kafka connection string, username or password found in configuration file | information | 0 | X | X | X | X | azure-message-queue-config.windup.xml |
| azure-message-queue-config-rabbitmq-01000 | RabbitMQ connection string, username or password found in configuration file | information | 0 | X | X | X | X | azure-message-queue-config.windup.xml |
| azure-message-queue-config-artemis-01000 | ActiveMQ Artemis connection string, username or password found in configuration file | information | 0 | X | X | X | X | azure-message-queue-config.windup.xml |
| azure-password-01000 | Password found in configuration file | potential | 3 | X | X | X | X | azure-password.windup.xml |
| azure-static-content-01000 | Static content found in the application | optional | 5 | X | X | X | X | azure-static-content.windup.xml |
| azure-system-config-01000 | Environment variables/system properties | optional | 1 | X | X | X | X | azure-system-config.windup.xml |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset id="azure-mq-config"
<ruleset id="azure-message-queue-config"
xmlns="http://windup.jboss.org/schema/jboss-ruleset"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd">
<metadata>
<description>
This ruleset identifies message queue connection strings, usernames, or passwords.
This ruleset identifies message queue.
</description>
<dependencies>
<addon id="org.jboss.windup.rules,windup-rules-xml,3.0.0.Final"/>
Expand All @@ -17,7 +17,7 @@
<tag>message queue</tag>
</metadata>
<rules>
<rule id="azure-mq-config-kafka-01000">
<rule id="azure-message-queue-config-kafka-01000">
<when>
<filecontent filename="{*}.{extensions}" pattern="{pattern}"/>
</when>
Expand Down Expand Up @@ -47,7 +47,7 @@
</where>
</rule>
<!-- Rule for detecting RabbitMQ configurations -->
<rule id="azure-mq-config-rabbitmq-01000">
<rule id="azure-message-queue-config-rabbitmq-01000">
<when>
<filecontent filename="{*}.{extensions}" pattern="{pattern}"/>
</when>
Expand Down Expand Up @@ -78,7 +78,7 @@
</rule>

<!-- Rule for detecting Artemis configurations -->
<rule id="azure-mq-config-artemis-01000">
<rule id="azure-message-queue-config-artemis-01000">
<when>
<filecontent filename="{*}.{extensions}" pattern="{pattern}"/>
</when>
Expand Down Expand Up @@ -109,5 +109,79 @@
<matches pattern="artemis\.(broker-url|user|password)"/>
</where>
</rule>

<rule id="azure-message-queue-rabbitmq-01000">
<when>
<javaclass references="org.springframework.amqp.rabbit.{*}"/>
</when>
<perform>
<hint title="Spring RabbitMQ usage found in code" category-id="information" effort="0">
<message>
The application uses Spring RabbitMQ based on Spring AMQP. To migrate a Java application that uses Spring RabbitMQ to Azure, you can follow these recommendations:

* Provision **Azure Service Bus**: Replace RabbitMQ with Azure Service Bus, a fully managed messaging service that offers reliable message queuing and publish/subscribe capabilities.

* Update the application's **messaging connection** details: Modify the Java application's configuration updating the connection information and message queues/topics.

* Configure Azure Service Bus **queues/topics**: Create appropriate queues or topics in Azure Service Bus to align with your application's messaging requirements. Configure access control and security settings as needed.
</message>
<link title="Azure Service Bus documentation" href="https://learn.microsoft.com/azure/service-bus-messaging"/>
<link title="Use Azure Service Bus in Spring applications" href="https://learn.microsoft.com/azure/developer/java/spring-framework/using-service-bus-in-spring-applications"/>
<tag>RabbitMQ Client</tag>
</hint>
<technology-tag level="INFORMATIONAL">RabbitMQ Client</technology-tag>
</perform>
</rule>

<rule id="azure-message-queue-amqp-01000">
<when>
<javaclass references="org.springframework.amqp.{*}"/>
</when>
<perform>
<hint title="Spring AMQP usage found in code" category-id="information" effort="0">
<message>
The application uses Spring AMQP in code. To migrate a Java application that uses Spring AMQP to Azure, you can follow these recommendations:

* Provision **Azure Service Bus**: Use Azure Service Bus, a fully managed messaging service that offers reliable message queuing and publish/subscribe capabilities.

* Update the application's **messaging connection** details: Modify the Java application's configuration updating the connection information and message queues/topics.

* Configure Azure Service Bus **queues/topics**: Create appropriate queues or topics in Azure Service Bus to align with your application's messaging requirements. Configure access control and security settings as needed.
</message>
<link title="Azure Service Bus documentation" href="https://learn.microsoft.com/azure/service-bus-messaging"/>
<link title="Use Azure Service Bus in Spring applications" href="https://learn.microsoft.com/azure/developer/java/spring-framework/using-service-bus-in-spring-applications"/>
<tag>AMQP Client</tag>
</hint>
<technology-tag level="INFORMATIONAL">AMQP Client</technology-tag>
</perform>
</rule>

<rule id="azure-message-queue-amqp-02000">
<when>
<or>
<file filename="{*}amqp{*}"/>
<project>
<artifact groupId="org.springframework.boot" artifactId="spring-boot-starter-amqp"/>
</project>
</or>
</when>
<perform>
<hint title="Spring AMQP dependency found" category-id="information" effort="0">
<message>
The application uses Spring AMQP dependency. To migrate a Java application that uses Spring AMQP to Azure, you can follow these recommendations:

* Provision **Azure Service Bus**: Use Azure Service Bus, a fully managed messaging service that offers reliable message queuing and publish/subscribe capabilities.

* Update the application's **messaging connection** details: Modify the Java application's configuration updating the connection information and message queues/topics.

* Configure Azure Service Bus **queues/topics**: Create appropriate queues or topics in Azure Service Bus to align with your application's messaging requirements. Configure access control and security settings as needed.
</message>
<link title="Azure Service Bus documentation" href="https://learn.microsoft.com/azure/service-bus-messaging"/>
<link title="Use Azure Service Bus in Spring applications" href="https://learn.microsoft.com/azure/developer/java/spring-framework/using-service-bus-in-spring-applications"/>
<tag>AMQP Client</tag>
</hint>
<technology-tag level="INFORMATIONAL">AMQP Client</technology-tag>
</perform>
</rule>
</rules>
</ruleset>
12 changes: 6 additions & 6 deletions rules/rules-reviewed/azure/tests/azure-mq-config.windup.test.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruletest id="azure-mq-config-test"
<ruletest id="azure-message-queue-config-test"
xmlns="http://windup.jboss.org/schema/jboss-ruleset"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd">
<testDataPath>data/azure-mq-config</testDataPath>
<rulePath>../azure-mq-config.windup.xml</rulePath>
<testDataPath>data/azure-message-queue-config</testDataPath>
<rulePath>../azure-message-queue-config.windup.xml</rulePath>
<ruleset>
<rules>
<rule id="azure-mq-config-kafka-test-01000">
<rule id="azure-message-queue-config-kafka-test-01000">
<when>
<not>
<iterable-filter size="3">
Expand All @@ -19,7 +19,7 @@
<fail message="mq-config-kafka hint was not found!"/>
</perform>
</rule>
<rule id="azure-mq-config-rabbitmq-test-01000">
<rule id="azure-message-queue-config-rabbitmq-test-01000">
<when>
<not>
<iterable-filter size="1">
Expand All @@ -31,7 +31,7 @@
<fail message="mq-config-rabbitmq hint was not found!"/>
</perform>
</rule>
<rule id="azure-mq-config-artemis-test-01000">
<rule id="azure-message-queue-config-artemis-test-01000">
<when>
<not>
<iterable-filter size="1">
Expand Down
Loading