amqphub / amqp-10-jms-spring-boot

AMQP 1.0 JMS Binding for Spring Boot
Apache License 2.0
34 stars 25 forks source link

javax.jms.JMSException: Channel was inactive for too (>30000) long: tcp://127.0.0.1:5672 #12

Closed kushmpatel closed 1 year ago

kushmpatel commented 1 year ago

I'm using this library to connect to amqp server, but getting this error. javax.jms.JMSException: Channel was inactive for too (>30000) long: tcp://127.0.0.1:5672

application.yml

amqphub.amqp10jms.remote-url: amqp://127.0.0.1:5672

build.gradle

plugins { id 'org.springframework.boot' }

group = 'com.xxx.xxxxx' version = '0.0.1-SNAPSHOT'

ext { influxDBVersion = "6.7.0"

}

tasks.named("jar") { enabled = false }

tasks.named("bootJar") { archiveFileName = "iot-gateway" }

repositories { mavenCentral() }

configurations { compileOnly { extendsFrom annotationProcessor }

testCompileOnly {
    extendsFrom testAnnotationProcessor
}

}

dependencies {

// Spring boot
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-cache'

// Spring Cloud Azure Integration
implementation 'com.azure.spring:spring-cloud-azure-starter'
implementation 'com.azure.spring:spring-cloud-azure-starter-integration-servicebus'

//inFlux DB
implementation "com.influxdb:influxdb-client-java:${influxDBVersion}"

//activeMQ
//implementation 'org.springframework.boot:spring-boot-starter-activemq'
implementation 'org.apache.activemq:activemq-amqp:5.16.0'
implementation 'org.apache.qpid:qpid-jms-client:2.1.0'
implementation 'org.amqphub.spring:amqp-10-jms-spring-boot-starter:0.3.0'

// Others - External
annotationProcessor 'org.projectlombok:lombok'
implementation 'org.apache.commons:commons-lang3:3.12.0'

// Test Dependencies
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testAnnotationProcessor 'org.projectlombok:lombok'

}

tasks.named('test') { useJUnitPlatform() }

ActiveMQProducerService.java

@Component @Slf4j public class ActiveMQProducerService implements GenericHandler { @Autowired JmsTemplate jmsTemplate;

@Value("${topic}")
private String topic;

public Sensor sendMessage(String payload){
    try{
        log.info("Sending message to Topic: "+ topic);
        //jmsTemplate.convertAndSend(topic, payload);
        jmsTemplate.convertAndSend(topic,payload);
        log.info("Message sent to topic = "+topic);
    } catch(Exception e){
        //throw new SensorDataProcessingException("Received Exception during sending for Message: "+sensor.toString());
        log.error("Received Exception during sending for Message: "+sensor.toString(), e);
    }
    return sensor;
}

@Override
public Object handle(String payload, MessageHeaders headers) {
    sendMessage(payload);
    return payload;
}

}

Can anyone help me why I get this error ? If I run your amqp-10-jms-spring-boot-hello-world, then it is working fine. My activeMQ server is also running properly on my local system. I don't know why I get this error.

tabish121 commented 1 year ago

Is the error from the client or from the server side. It would be unlikely to have anything to do with the starter as it is just a simple wrapper around Qpid JMS

tabish121 commented 1 year ago

Closing due to lack of response