Skip to content

Commit

Permalink
feat: Add dynamic amount of messages for Artemis producer (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
JorTurFer authored Oct 30, 2024
1 parent b3aea90 commit 2980a46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.bal.config.ProducerConfiguration;
import org.bal.producer.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -12,6 +13,9 @@
@SpringBootApplication(scanBasePackageClasses = {ProducerConfiguration.class}, scanBasePackages = "org.bal")
public class App implements CommandLineRunner {

@Value("${artemis.messages}")
private int messages;

@Autowired
private Producer producer;

Expand All @@ -22,7 +26,7 @@ public static void main(String[] args) {

@Override
public void run(String... args) throws Exception {
for (int i = 0; i < 1000; i++){
for (int i = 0; i < messages; i++){
producer.send("Message is: " + System.currentTimeMillis());
sleep(10);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ spring:
host: ${ARTEMIS_SERVER_HOST:10.152.183.227}
port: ${ARTEMIS_SERVER_PORT:61616}
user: ${ARTEMIS_USERNAME:artemis}
password: ${ARTEMIS_PASSWORD:artemis}
password: ${ARTEMIS_PASSWORD:artemis}
messages: ${ARTEMIS_MESSAGE_COUNT:1000}

0 comments on commit 2980a46

Please sign in to comment.