首页 \ 问答 \ 活跃的mq Artemis转移伐木(Active mq Artemis divert logging)

活跃的mq Artemis转移伐木(Active mq Artemis divert logging)

有没有办法记录有效的mq Artemis转移? 那么你可以看到哪个转移应用于给定的消息? 我似乎无法在文档中找到这个。


Is there a way to log active mq Artemis diverts? So you can see which divert was applied to a given message? I can't seem to find this in the docs.


原文:https://stackoverflow.com/questions/48372892
更新时间:2023-08-20 08:08

最满意答案

这里有一些问题。

首先,您没有正确使用Thread类, 请查看本教程以开始使用

即使您确实更正了Thread类的使用,您要么最终阻止UI线程,要么最终会遇到跨线程异常。

在这种情况下,您可能最简单的方法是使用DispatcherTimer

public MainPage()
{
    InitializeComponent();
    DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromHours(1) };
    timer.Tick += new EventHandler(timer_Tick);
    SetImageSource();
    timer.Start();
}

void timer_Tick(object sender, EventArgs e)
{
    SetImageSource();
}

void SetImageSource()
{
    int hour = DateTime.Now.Hour;
    if (hour % 10 == 0)
        imag1.Source = new BitmapImage(new Uri("img/knapTaand.png", UriKind.Relative));
    else
        imag1.Source = new BitmapImage(new Uri("img/knapSluk.png", UriKind.Relative));
}

There are a few problems here.

First you are not using the Thread class correctly, check this tutorial to get started

Even when you do correct your usage of the Thread class, you are either going to end up blocking the UI Thread, or you will end up with a Cross-Thread exception.

In this case, perhaps the easiest way for you to achieve what you want is to use a DispatcherTimer

public MainPage()
{
    InitializeComponent();
    DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromHours(1) };
    timer.Tick += new EventHandler(timer_Tick);
    SetImageSource();
    timer.Start();
}

void timer_Tick(object sender, EventArgs e)
{
    SetImageSource();
}

void SetImageSource()
{
    int hour = DateTime.Now.Hour;
    if (hour % 10 == 0)
        imag1.Source = new BitmapImage(new Uri("img/knapTaand.png", UriKind.Relative));
    else
        imag1.Source = new BitmapImage(new Uri("img/knapSluk.png", UriKind.Relative));
}

相关问答

更多
  • 是的,在.NET平台上使用C#创建GUI非常容易。 为了您的目的。 您将需要以下类/控件: 形成 的MenuStrip 工具条 StatusStrip中 DataView的/的DataGridView 文本框 标签 的TabControl TabPage的 图片框 按键 和其他人(你需要弄清楚)。 只需在MSDN中浏览这些类(你会在那里找到很多例子)。 如果你想快速启动。 否则我得到一本好书,有坚实的基础。 Yeah its very easy to create GUI using C# on .NET ...
  • 解决了: 问题似乎是,该事件立即被触发但文件尚未最终复制。 这意味着我们必须等到文件空闲。 事件开始时的Thread.Sleep(100)完成工作。 我现在知道谷歌的用途,我找到了两个链接: 这个和这个你可以找到: 创建文件后立即引发OnCreated事件。 如果正在将文件复制或传输到监视目录中,则会立即引发OnCreated事件,然后是一个或多个OnChanged事件 因此,对我的情况最有效的方法是包括一个方法来测试文件是否仍然被锁定,而不是在事件开始时等待解锁文件。 无需额外的线程或Background ...
  • 这里有一些问题。 首先,您没有正确使用Thread类, 请查看本教程以开始使用 即使您确实更正了Thread类的使用,您要么最终阻止UI线程,要么最终会遇到跨线程异常。 在这种情况下,您可能最简单的方法是使用DispatcherTimer public MainPage() { InitializeComponent(); DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromHours(1) }; ...
  • 在不调用bindingSource1.EndEdit您的基础DataTable看不到任何更改,因此Update命令无需更新。 private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { bindingSource1.EndEdit(); DataTable dt = (DataTable)bindingSource1.DataSource; // Just for test ...
  • 通过id获取图片。 要加入URL部分,请使用urlparse.urljoin() : base_url = 'http://www.weatheronline.co.uk' print urljoin(base_url, soup.find('img', id='pictureid')['src']) Get the pictures by id. To join URL parts, use urlparse.urljoin(): base_url = 'http://www.weatheronline ...
  • 您可能需要为C项目创建托管代码包装器,以便可以从C#访问它。 请参阅此前提出的问题:将C ++移植(非托管)到C#与在C#应用程序中使用C ++作为DLL You are probably going to need to create a managed code wrapper for your C project so that it can be accessed from C#. See this previously asked question: Porting (unmanaged) C++ ...
  • pushbutton1_Callback和pushbutton2_Callback是projetGUI_OpeningFcn嵌套函数吗? 如果没有,那么是的, img仅存在于projetGUI_OpeningFcn的工作空间中, projetGUI_OpeningFcn存在于其他两个函数的工作空间中。 一个可能的解决方法是在projetGUI_OpeningFcn和guidata(hObject, handles);使用handles.img而不是img guidata(hObject, handles); ...
  • 让你的列表项目实现一个接口,提供显示所需的所有内容: public interface IDisplayItem { event System.ComponentModel.ProgressChangedEventHandler ProgressChanged; string Subject { get; } string Description { get; } // Provide everything you need for the display here } 传 ...
  • 确保您的对象彼此通信:您的myOtherClass将不得不知道AcquireForm对象 - 您不能只创建一个新对象(如您所发现的那样)。 您需要将AcquireForm 对象传递给myOtherClass 对象 (例如myOtherObject.SetForm(myAcquireForm)),并在需要时引用它。 如果你遇到调用问题可能会有所帮助 - 我如何调用“下一步”按钮点击: BeginInvoke(new Action(()=>button_next_Click(null,null))); 此外, ...
  • value是一个只能应用于表单元素的属性,如input 。 如果要获取简单属性,请使用name 。 value is an attribute that can only be applied to form elements, like input. If you want to get a simple attribute, use name.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)