您好,我使用
我使用的JMS连接到IBM WebSphere MQ时遇到一个大问题:
我命名为一个QueueManager,命名为test1一个队列,命名为test1q一个协商通道test1channel
StandaloneSender s = new StandaloneSender();
try{
s.send(“hello word”);
}catch (Exception e){
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
import javax.jms.Message;
import javax.jms.QueueConnection;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.naming.NamingException;
public class StandaloneSender {
private P2PUtils utils;
private QueueConnection connection;
private QueueSession session;
private QueueSender sender;
public void send(String message) throws NamingException, JMSException, IOException {
StandaloneSender sender = new StandaloneSender();
sender.connect();
sender.sendMessage(message);
sender.disconnect();
}
public …Run Code Online (Sandbox Code Playgroud) 我有 JSON 字符串,想要转换为 java 属性文件。注意:JSON 可以是 JSON 字符串、对象或文件。示例 JSON:
{
"simianarmy": {
"chaos": {
"enabled": "true",
"leashed": "false",
"ASG": {
"enabled": "false",
"probability": "6.0",
"maxTerminationsPerDay": "10.0",
"IS": {
"enabled": "true",
"probability": "6",
"maxTerminationsPerDay": "100.0"
}
}
}
}
}
**OUTPUT SHOULD BE:-**
simianarmy.chaos.enabled=true
simianarmy.chaos.leashed=false
simianarmy.chaos.ASG.enabled=false
simianarmy.chaos.ASG.probability=6.0
simianarmy.chaos.ASG.maxTerminationsPerDay=10.0
simianarmy.chaos.ASG.IS.enabled=true
simianarmy.chaos.ASG.IS.probability=6
simianarmy.chaos.ASG.IS.maxTerminationsPerDay=100.0
Run Code Online (Sandbox Code Playgroud)