标签: message-queue

WM_DESTROY,WM_CLOSE绕过IMessageFilter

以下是我的消息过滤器:

bool MyFilter::PreFilterMessage(Message %m){
    switch(m.Msg){
    case WM_CLOSE:
    case WM_DESTROY:
    case WM_NCDESTROY:
    case WM_QUIT:
        Debug::WriteLine(L"Gone!");
        break;
    case WM_MOUSEMOVE:
        Debug::WriteLine(L"A mouse! Catch! Catch!!! CATCH!!");
        break;
    }
    return false;
}
Run Code Online (Sandbox Code Playgroud)

我确认我正在过滤大多数邮件而没有问题.然而,我无法接收窗口的关闭按钮后,派出任何消息点击(WM_CLOSE,WM_DESTROY,WM_NCDESTROYWM_QUIT).为什么是这样?

.net windows message-queue imessagefilter winforms

1
推荐指数
1
解决办法
1044
查看次数

1
推荐指数
1
解决办法
4093
查看次数

UNIX消息队列msgrcv无法接收消息

亲爱的朋友们,不知道为什么msgrcv收到空白缓冲区?

这是代码:

enter code here
 #include <sys/msg.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <stdio.h>
 #include <string.h>

 typedef struct mymsg {
  long mtype;
  char mtext[24];
 }mymsg;

 int main()
 {
  int msqid;
  mymsg msg,buff;
  msqid=msgget(IPC_PRIVATE,IPC_CREAT|IPC_EXCL);

  if(msqid==-1){
  perror("FAiled to create message queue\n");
  }
  else{
  printf("Message queue id:%u\n",msqid);
  }
  msg.mtype=1;
  strcpy(msg.mtext,"This is a message");
  if(msgsnd(msqid,&msg,sizeof(msg.mtext),0)==-1){
   perror("msgsnd failed:");
  }
  else{
   printf("Message sent successfully\n");
  }
 //ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp,int msgflg);

  // msgrcv(msqid,buff.mtext,sizeof(msg.mtext),1,0); This was error
  msgrcv(msqid,&buff,sizeof(msg.mtext),1,0);  // This is correct (Thanks to …
Run Code Online (Sandbox Code Playgroud)

c unix message-queue msgrcv

1
推荐指数
1
解决办法
8598
查看次数

如何使Spring Integration HTTP出站通道适配器参与全局事务

我有以下Spring Integration配置.我在这里做的是dequeuing来自主题的消息,并在转换后将其发送到某个HTTP位置.

JMS Connection Factory 配置如下:

<bean id="inboundCF" 
class="org.springframework.jms.connection.CachingConnectionFactory">
    <constructor-arg index="0">
        <jee:jndi-lookup jndi-name="java:comp/resource/ABC_AQ/XATopicConnectionFactories/XATCF" />
    </constructor-arg>
    <property name="sessionCacheSize" value="3" />
</bean>
<bean id="txInboundCF"
class="org.springframework.jms.connection.TransactionAwareConnectionFactoryProxy">
    <property name="targetConnectionFactory" ref="inboundCF" />
<property name="synchedLocalTransactionAllowed" value="true" />
</bean>
Run Code Online (Sandbox Code Playgroud)

Message Listener Container配置如下:

<bean id="jmsInboundContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer"
destroy-method="destroy">
    <property name="connectionFactory" ref="txInboundCF" />
    <property name="destination" ref="inboundDestination" />
    <property name="pubSubDomain" value="true" />
    <property name="sessionTransacted" value="true" />
    <property name="errorHandler" ref="errorHandlerService" />
    <property name="subscriptionDurable" value="true" />
    <property name="durableSubscriptionName" value="mySub" />
    <property name="cacheLevel" value="3" />
</bean>
<int-jms:message-driven-channel-adapter channel="jmsInChannel" …
Run Code Online (Sandbox Code Playgroud)

java jms message-queue http-post spring-integration

1
推荐指数
1
解决办法
1746
查看次数

在远程计算机上创建私人消息队列

我已经读过,在C#中,我们无法在远程计算机上创建专用队列: 无法在远程服务器上创建专用消息队列

我的问题是:在PowerShell脚本中,我们可以这样做吗?这是我的示例脚本:

echo "Loading System.Messaging..."
[Reflection.Assembly]::LoadWithPartialName( "System.Messaging" )
$msmq = [System.Messaging.MessageQueue]

echo "Create the queue"

$qName = "remoteserver\private$\testqueue"  
if($msmq::Exists($qName))
{
    echo ($qName + " already exists ")           
}
else
{
    echo ($qName + " doesn't exists and now to create ......")      

    $q = $msmq::Create( $qName, $TRUE )     

    echo "Private queues has been created"
}
Run Code Online (Sandbox Code Playgroud)

它说"无效的队列路径名称".我也尝试过一些格式:FormatName:DIRECT=OS:remoteserver\private$\testqueue

结果是一样的.任何可能性?

windows powershell message-queue powershell-remoting

1
推荐指数
1
解决办法
2150
查看次数

使用Java停止队列监听RabbitMQ

嗨,我在我的Java应用程序中使用RabbitMQ。当我停止应用程序时,我需要确保在停止应用程序之前停止队列侦听器(停止从队列接收消息)。我不确定是否需要调用channel.close()channel.basicCancel(“ tag”)。编写了以下代码来停止队列侦听。

if(myContext.myChannel.isOpen()){ 

  //myChannel is the one I am using to listen to queue 
  myContext.myChannel.basicCancel("OP"); 

  //myContext.myChannel.close(); 
}else{ 
   return ok("Channel is not open"); 
}
Run Code Online (Sandbox Code Playgroud)

java message-queue rabbitmq

1
推荐指数
1
解决办法
3668
查看次数

从background.js发送消息到没有监听器的popup.js

我有一个很长的任务正在运行background.js,我想popup.js在完成后发送一条消息.但是,如果在发送消息时未单击页面操作,则popup.js尚未注册侦听器,并且不会接收消息.

我可以从popup.js响应中发送消息并请求后台任务的结果.但是,无法保证任务将在该时间点完成.

我看到的唯一解决方案是两者的结合:在两个文件中设置一个监听器并来回发送消息,这样说:"如果你能听到我的话就会得到结果!" 并且"我现在可以听到了!如果你完成了,请给我一个结果." 但是,对于这样一个简单的任务,这个解决方案似乎过于复杂.

那么,是不是有一些地方background.js可以把结果popup.js放在自己的休闲时间检索?

javascript google-chrome message-queue listener google-chrome-extension

1
推荐指数
1
解决办法
3207
查看次数

有人可以帮我理解静态队列和动态队列之间的区别吗?


当我在处理Message-Queue时,遇到静态队列动态队列这个词.
任何人都可以告诉我区别吗?

activemq-classic message-queue ibm-mq

1
推荐指数
1
解决办法
2222
查看次数

使用IF语句运行命令之前先执行Powershell OS检查

有没有一种方法可以检查正在运行PowerShell脚本的操作系统,并发出一条If声明:

[伪代码]

if its this OS 
    do this 
if its this other OS 
    do this 
Run Code Online (Sandbox Code Playgroud)

仅针对脚本中的特定行?我必须制作一个设置私人消息队列的PowerShell脚本。遗憾的是,我公司的某些客户端未使用Windows Server 2012,因此添加私有消息队列的更简单版本无法在Windows Server 2008和过时的PowerShell版本上使用。要解决此问题,我还必须改用非常复杂的旧方法,但是我希望这两种方法都存在。

powershell operating-system message-queue

1
推荐指数
1
解决办法
9989
查看次数

我的channel.basicConsume为何不等待消息

每当我启动以下代码时:

    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost("localhost");
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();
    String exchangeName = "direct_logs";
    channel.exchangeDeclare(exchangeName, "direct");
    String queueName = channel.queueDeclare().getQueue();
    channel.queueBind(queueName, exchangeName, "red");
    channel.basicQos(1);

    final Consumer consumer = new DefaultConsumer(channel){
        @Override
        public void handleDelivery(String consumerTag,
                                   Envelope envelope,
                                   AMQP.BasicProperties properties,
                                   byte[] body) throws IOException{
            String message = new String(body, "UTF-8");
            System.out.println(message);
            System.out.println("message received");
        }
    };

    channel.basicConsume(queueName, true, consumer);
Run Code Online (Sandbox Code Playgroud)

它不会像文档中所暗示的那样开始无限循环。相反,它会立即停止。我可以消耗一段时间的唯一方法是channel.basicConsume用循环替换,如下所示:

    DateTime startedAt = new DateTime();
    DateTime stopAt = startedAt.plusSeconds(60);
    long i=0;
    try {
        while (stopAt.compareTo(new …
Run Code Online (Sandbox Code Playgroud)

message-queue rabbitmq java-8

1
推荐指数
1
解决办法
2560
查看次数