Best Of
Re: Binary to ASCII
Hi again @Naruto. No, SdkPerf has no pluggable capabilities for providing a deserialization mechanism. You'd have to code something yourself if you know the proper encoding format.
Re: Cleanup of Unused Queues
BTW: when you say "beyond a defined TTL", I just want to make sure you're saying what I'm thinking you're saying (but also for anyone stumbling on this later):
Often, queues in dev fill up because devs are publishing away, but not necessarily consuming from them. Queues fill up, can cause spool full issues, stop your broker from accepting any new Guaranteed messages. A great way to keep developer queues "trimmed" is to ensure that queues created in dev have a "max TTL" set to something reasonable (e.g. 3 days), and "respect TTL" is enabled.
For admin-created queues, this can be done by the broker administrator. But for any application-created queues, this policy can be enforced by the use of queue templates, associated with the developer's application's client profile.
Re: Filtering messages on a topic by the consumer
Glad to help @tbhargava18
That helped. I have one more doubt about the topics. What happens to the data published to topics that are not read by any subscriber. Do we have to do a deliberate cleanup of the topics or that is managed by Solace itself?
Nope, no clean-up necessary! if there are no subscribers then the broker won't keep it around unless you have replay configured for that topic.
Re: Regarding issue with the dll
And even if you downloaded the API from our downloads page, it's still bundled in there too:
solclient_dotnet_10.24.0$ find . -name "libsolclient.dll" ./bin/Win32/libsolclient.dll ./bin/Win64/libsolclient.dll ./runtimes/win-x64/native/libsolclient.dll ./runtimes/win-x86/native/libsolclient.dll
So maybe just a "classpath" (Java speak) issue, something wrong with project config?
Re: Regarding issue with the dll
Actually, I see the root of your exception is UIPath invoking code. I suspect the solution to your problem is determining how to properly register external dll's for UIPath to be able to invoke that code. Ie, it looks more like a UIPath configuration issue than a csproj issue.
Re: Regarding issue with the dll
Have you tried manually restoring nuget packages? Are you building for a windows target? The libsolclient.dll is provided by the SolaceSystems.SolClient.Messaging
package. You can see it here
under the build\net20\win-x64 (or win-x86) directories.
Re: java.lang.ClassCastException: Solace QueueProxy cannot be cast to Weblogic DestinationImpl
UPDATE:
I tried a bunch to get this to work but unfortunately couldn't. So I finally decided to just forego this Message Driven Bean approach and reworked the whole thing by simply implementing a Message Listener in the class file. And whaddya know the simplest solution is the one that works.
This is the modified code:
package main; //<Imports here> public class TopicConsumer implements MessageListener {
private ConnectionFactory connectionFactory;
private Connection connection;
private Session session;
private MessageConsumer messageConsumer;
private final String CONNECTION_FACTORY_JNDI_NAME = "JNDI/J2C/CF";
TopicConsumer() throws InterruptedException {
initialize();
}
@Override
public void onMessage(Message message) {
try {
if (message instanceof TextMessage) {
System.out.printf("TextMessage received: '%s'%n", ((TextMessage) message).getText());
} else {
System.out.println("Message received.");
System.out.printf("Message Content:%n%s%n", SolJmsUtility.dumpMessage(message));
}
// ACK the received message manually because of the set SupportedProperty.SOL_CLIENT_ACKNOWLEDGE above
message.acknowledge();
} catch (JMSException ex) {
System.out.println("Error processing incoming message.");
ex.printStackTrace();
}
}
public void initialize() throws InterruptedException {
try {
Hashtable<String, Object> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
InitialContext initialContext = new InitialContext(env);
connectionFactory = (ConnectionFactory) initialContext.lookup(CONNECTION_FACTORY_JNDI_NAME);
System.out.println("Connection Factory " + connectionFactory + " established");
connection = connectionFactory.createConnection();
System.out.println("Connection " + connection + " created");
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue("MyQueue");
messageConsumer = session.createConsumer(queue);
messageConsumer.setMessageListener(this);
connection.start();
System.out.println("Awaiting message...");
} catch (NamingException | JMSException e) {
e.printStackTrace();
}
finally {
try{
connection.stop();
messageConsumer.close();
session.close();
connection.close();
} catch (Exception e) {
System.err.println("Error sending message: " + e.getMessage());
e.printStackTrace();
}
}
} }
Similar to the case with my producer code I directly gave the actual destination name instead of doing a JNDI lookup while creating the Queue. I don't know why i tried to make it extra complicated with the MDB.
Anyways hope this helps anyone else facing the issue. Cheers !!
Re: Content resolution example with Spring Cloud Stream
Re the Person
code above …
@JsonInclude(JsonInclude.Include.NON_NULL)
Isn't needed. Works with just a POJO with no special annotations.
Re: Content resolution example with Spring Cloud Stream
@dakotahnorth, as you see in the Spring Cloud Stream documentation the framework automatically provides this deserialization for you as long as it can understand the payload.
We have examples of it in our samples repo here:
- see the cloud-stream-sink for the simplest of examples:https://github.com/SolaceSamples/solace-samples-spring/tree/master/cloud-stream-sink
Note that the framework provides these MessageConverters and if you need others you can see the "User-defined Message Converters" section right after that one.
FYI @Aaron no need to do the serialization and deserialization yourself!
Re: Content resolution example with Spring Cloud Stream
Urgh … so embarrassing! Since the documentation had the Person class as part of the same class, I just figured it was the "correct" way.
Thank you for point that out, as well as, the quotes!
SUPER, SUPER helpful!