🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

How to configure the @JmsListener and receive Solace Topic messages ?

bxb
bxb Member Posts: 12 ✭✭

Hi @marc , I followed your tutorial in this thread, how to listen to Solace Topic via JMS. I tried to configure it in my program as well, but I got an error of : unknown endpoint (503: Unknown Queue). 
I just started learning Solace, can you help me find the issue ? 
Think you~
This is my JMS configurations:
@Bean("connectionFactory")
public ConnectionFactory connectionFactory() throws Exception {
    Properties env = new Properties();
    env.put(InitialContext.INITIAL_CONTEXT_FACTORY, "com.solacesystems.jndi.SolJNDIInitialContextFactory");
    env.put(InitialContext.PROVIDER_URL, solaceProperties.getBrokerUrl());
    env.put(SupportedProperty.SOLACE_JMS_VPN, solaceProperties.getVpn());
    env.put(InitialContext.SECURITY_PRINCIPAL, solaceProperties.getUsername());
    env.put(InitialContext.SECURITY_CREDENTIALS, solaceProperties.getPassword());
    SolConnectionFactory solConnectionFactory = SolJmsUtility.createConnectionFactory(env);
    return solConnectionFactory;
}

@JmsListener(destination = "TestTopic01")
void receiveMsgFromTopic(Message msg) {
    log.info("received Solace Topic message>>>>>>>>>>");
    StringBuffer msgAsStr = new StringBuffer("============= Received \nHeaders:");
    MessageHeaders hdrs = msg.getHeaders();
    msgAsStr.append("\nUUID: " + hdrs.getId());
    msgAsStr.append("\nTimestamp: " + hdrs.getTimestamp());
    Iterator<String> keyIter = hdrs.keySet().iterator();
    while (keyIter.hasNext()) {
        String key = keyIter.next();
        msgAsStr.append("\n" + key + ": " + hdrs.get(key));
    }
    msgAsStr.append("\nPayload: " + msg.getPayload());
    log.info(msgAsStr.toString());
}

I have configured "spring.jms.pub-sub-domain=true" in my application.properties file.

But my program reports an error : Unknown Queue

Answers

  • bxb
    bxb Member Posts: 12 ✭✭

    @marc I'm sorry, I think I have solved this issue by configuring the DefaultJmsListenerContainerFactory