-
Notifications
You must be signed in to change notification settings - Fork 1
Setting up Activemq #128
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
Open
dinesh-beehyv
wants to merge
10
commits into
master
Choose a base branch
from
Setting-up-Activemq
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Setting up Activemq #128
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0587309
Merge remote-tracking branch 'origin/master'
dinesh-beehyv 66b3130
Merge remote-tracking branch 'origin/master'
dinesh-beehyv 24f4133
Merge remote-tracking branch 'origin/master'
dinesh-beehyv 22cdd24
Merge remote-tracking branch 'origin/master'
dinesh-beehyv 98f1389
Merge remote-tracking branch 'origin/master'
dinesh-beehyv 1e48bf5
Merge remote-tracking branch 'origin/master'
dinesh-beehyv caf087c
Merge remote-tracking branch 'origin/master'
dinesh-beehyv 7d67393
Active mq config changes
dinesh-beehyv dced51c
coderrabbit comment fix.Updated ActiveMQ dependency version from 5.15…
dinesh-beehyv 380f26d
removed extra dependencies
dinesh-beehyv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/config/ActiveMQConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| package com.beehyv.nmsreporting.config; | ||
|
|
||
| import org.apache.activemq.ActiveMQConnectionFactory; | ||
| import org.apache.activemq.command.ActiveMQQueue; | ||
| import org.springframework.beans.factory.annotation.Value; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.ComponentScan; | ||
| import org.springframework.context.annotation.Configuration; | ||
| 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.MessageConverter; | ||
| import org.springframework.jms.support.converter.SimpleMessageConverter; | ||
|
|
||
| import javax.jms.ConnectionFactory; | ||
| import javax.jms.Queue; | ||
|
|
||
| import java.util.Arrays; | ||
|
|
||
| import static com.beehyv.nmsreporting.utils.Global.getPropertyValueApp; | ||
|
|
||
| @Configuration | ||
| @EnableJms | ||
| @ComponentScan(basePackages = {"com.beehyv.nmsreporting.listeners", "com.beehyv.nmsreporting.otherpackages"}) | ||
| public class ActiveMQConfig { | ||
|
|
||
| private static final String activeMqUrl = getPropertyValueApp("activeMqUrl"); | ||
|
|
||
|
|
||
| @Bean | ||
| public ActiveMQConnectionFactory connectionFactory() { | ||
| ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(); | ||
| factory.setBrokerURL(activeMqUrl); | ||
| factory.setTrustAllPackages(false); // Don't trust all packages for security | ||
| factory.setTrustedPackages(Arrays.asList( | ||
| "com.beehyv.nmsreporting.model", | ||
| "com.beehyv.nmsreporting.entity", | ||
| "java.util", | ||
| "java.lang" | ||
| )); | ||
| return factory; | ||
| } | ||
|
|
||
| @Bean | ||
| public JmsTemplate jmsTemplate() { | ||
| JmsTemplate template = new JmsTemplate(); | ||
| template.setConnectionFactory(connectionFactory()); | ||
| template.setMessageConverter(messageConverter()); | ||
| return template; | ||
| } | ||
|
|
||
| @Bean | ||
| public MessageConverter messageConverter() { | ||
| return new SimpleMessageConverter(); | ||
| } | ||
|
|
||
| @Bean | ||
| public JmsListenerContainerFactory<?> jmsListenerContainerFactory(ConnectionFactory connectionFactory) { | ||
| DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory(); | ||
| factory.setConnectionFactory(connectionFactory); | ||
| // Optional: Configure additional settings | ||
| factory.setConcurrency("1-5"); // 1-5 concurrent consumers | ||
| factory.setRecoveryInterval(1000L); // 1 second recovery interval | ||
| return factory; | ||
| } | ||
| } |
54 changes: 54 additions & 0 deletions
54
NMSReportingSuite/src/main/java/com/beehyv/nmsreporting/entity/ReportMessage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package com.beehyv.nmsreporting.entity; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.util.Date; | ||
|
|
||
|
|
||
| public class ReportMessage implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
| private String reportType; | ||
| private Date fromDate; | ||
| private Date toDate; | ||
| private boolean isWeekly; | ||
|
|
||
| public ReportMessage() {} | ||
|
|
||
| public ReportMessage(String reportType, Date fromDate, Date toDate, boolean isWeekly) { | ||
| this.reportType = reportType; | ||
| this.fromDate = fromDate; | ||
| this.toDate = toDate; | ||
| this.isWeekly = isWeekly; | ||
| } | ||
|
|
||
| public String getReportType() { | ||
| return reportType; | ||
| } | ||
|
|
||
| public void setReportType(String reportType) { | ||
| this.reportType = reportType; | ||
| } | ||
|
|
||
| public Date getFromDate() { | ||
| return fromDate; | ||
| } | ||
|
|
||
| public void setFromDate(Date fromDate) { | ||
| this.fromDate = fromDate; | ||
| } | ||
|
|
||
| public Date getToDate() { | ||
| return toDate; | ||
| } | ||
|
|
||
| public void setToDate(Date toDate) { | ||
| this.toDate = toDate; | ||
| } | ||
|
|
||
| public boolean isWeekly() { | ||
| return isWeekly; | ||
| } | ||
|
|
||
| public void setWeekly(boolean weekly) { | ||
| isWeekly = weekly; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.