Clear message queue windows

Содержание
  1. Clear-MSMQQueue
  2. Syntax
  3. Description
  4. Examples
  5. Example 1: Clear message queues based on name
  6. Parameters
  7. Using Messages and Message Queues
  8. Creating a Message Loop
  9. Examining a Message Queue
  10. Posting a Message
  11. Sending a Message
  12. Управление сообщениями в очередях Manage messages in queues
  13. Что нужно знать перед началом работы What do you need to know before you begin?
  14. Удаление сообщений из очередей Remove messages from queues
  15. Для удаления сообщений используйте viewer queue Viewer в ящике инструментов Exchange Use Queue Viewer in the Exchange Toolbox to remove messages
  16. Удаление сообщений с помощью оболочки Use the Shell to remove messages
  17. Как убедиться, что все получилось? How do you know this worked?
  18. Возобновление доставки сообщений, находящихся в очередях Resume messages in queues
  19. Для возобновления сообщений используйте средство просмотра очередей в ящике инструментов Exchange Use Queue Viewer in the Exchange Toolbox to resume messages
  20. Использование Shell для возобновления сообщений Use the Shell to resume messages
  21. Как убедиться, что все получилось? How do you know this worked?
  22. Приостановка сообщений, находящихся в очередях Suspend messages in queues
  23. Использование просмотра очередей в ящике инструментов Exchange для приостановки сообщений Use Queue Viewer in the Exchange Toolbox to suspend messages
  24. Использование командной консоли для приостановки сообщений Use the Shell to suspend messages
  25. Как убедиться, что все получилось? How do you know this worked?

Clear-MSMQQueue

Syntax

Description

The Clear-MsmqQueue cmdlet clears queues. Specify queues to clear by using MessageQueue objects. This cmdlet returns a MessageQueue object that represents the cleared outgoing queue.

Examples

Example 1: Clear message queues based on name

This command gets all the message queues that have names that start with the string Order by using the Get-MsmqQueue cmdlet. The command passes the results to the current cmdlet by using the pipeline operator. The current cmdlet clears each queue.

Parameters

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Aliases: cf
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Specifies an array of MessageQueue objects. This cmdlet clears the queues that the MessageQueue objects specify. This parameter accepts pipeline input.

Type: MessageQueue [ ]
Position: Named
Default value: None
Accept pipeline input: True
Accept wildcard characters: False

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Using Messages and Message Queues

The following code examples demonstrate how to perform the following tasks associated with Windows messages and message queues.

Creating a Message Loop

The system does not automatically create a message queue for each thread. Instead, the system creates a message queue only for threads that perform operations which require a message queue. If the thread creates one or more windows, a message loop must be provided; this message loop retrieves messages from the thread’s message queue and dispatches them to the appropriate window procedures.

Because the system directs messages to individual windows in an application, a thread must create at least one window before starting its message loop. Most applications contain a single thread that creates windows. A typical application registers the window class for its main window, creates and shows the main window, and then starts its message loop — all in the WinMain function.

You create a message loop by using the GetMessage and DispatchMessage functions. If your application must obtain character input from the user, include the TranslateMessage function in the loop. TranslateMessage translates virtual-key messages into character messages. The following example shows the message loop in the WinMain function of a simple Windows-based application.

The following example shows a message loop for a thread that uses accelerators and displays a modeless dialog box. When TranslateAccelerator or IsDialogMessage returns TRUE (indicating that the message has been processed), TranslateMessage and DispatchMessage are not called. The reason for this is that TranslateAccelerator and IsDialogMessage perform all necessary translating and dispatching of messages.

Examining a Message Queue

Occasionally, an application needs to examine the contents of a thread’s message queue from outside the thread’s message loop. For example, if an application’s window procedure performs a lengthy drawing operation, you may want the user to be able to interrupt the operation. Unless your application periodically examines the message queue during the operation for mouse and keyboard messages, it will not respond to user input until after the operation has completed. The reason for this is that the DispatchMessage function in the thread’s message loop does not return until the window procedure finishes processing a message.

You can use the PeekMessage function to examine a message queue during a lengthy operation. PeekMessage is similar to the GetMessage function; both check a message queue for a message that matches the filter criteria and then copy the message to an MSG structure. The main difference between the two functions is that GetMessage does not return until a message matching the filter criteria is placed in the queue, whereas PeekMessage returns immediately regardless of whether a message is in the queue.

The following example shows how to use PeekMessage to examine a message queue for mouse clicks and keyboard input during a lengthy operation.

Other functions, including GetQueueStatus and GetInputState, also allow you to examine the contents of a thread’s message queue. GetQueueStatus returns an array of flags that indicates the types of messages in the queue; using it is the fastest way to discover whether the queue contains any messages. GetInputState returns TRUE if the queue contains mouse or keyboard messages. Both of these functions can be used to determine whether the queue contains messages that need to be processed.

Posting a Message

You can post a message to a message queue by using the PostMessage function. PostMessage places a message at the end of a thread’s message queue and returns immediately, without waiting for the thread to process the message. The function’s parameters include a window handle, a message identifier, and two message parameters. The system copies these parameters to an MSG structure, fills the time and pt members of the structure, and places the structure in the message queue.

Читайте также:  Samsung np355 установка windows с флешки

The system uses the window handle passed with the PostMessage function to determine which thread message queue should receive the message. If the handle is HWND_TOPMOST, the system posts the message to the thread message queues of all top-level windows.

You can use the PostThreadMessage function to post a message to a specific thread message queue. PostThreadMessage is similar to PostMessage, except the first parameter is a thread identifier rather than a window handle. You can retrieve the thread identifier by calling the GetCurrentThreadId function.

Use the PostQuitMessage function to exit a message loop. PostQuitMessage posts the WM_QUIT message to the currently executing thread. The thread’s message loop terminates and returns control to the system when it encounters the WM_QUIT message. An application usually calls PostQuitMessage in response to the WM_DESTROY message, as shown in the following example.

Sending a Message

The SendMessage function is used to send a message directly to a window procedure. SendMessage calls a window procedure and waits for that procedure to process the message and return a result.

A message can be sent to any window in the system; all that is required is a window handle. The system uses the handle to determine which window procedure should receive the message.

Before processing a message that may have been sent from another thread, a window procedure should first call the InSendMessage function. If this function returns TRUE, the window procedure should call ReplyMessage before any function that causes the thread to yield control, as shown in the following example.

A number of messages can be sent to controls in a dialog box. These control messages set the appearance, behavior, and content of controls or retrieve information about controls. For example, the CB_ADDSTRING message can add a string to a combo box, and the BM_SETCHECK message can set the check state of a check box or radio button.

Use the SendDlgItemMessage function to send a message to a control, specifying the identifier of the control and the handle of the dialog box window that contains the control. The following example, taken from a dialog box procedure, copies a string from a combo box’s edit control into its list box. The example uses SendDlgItemMessage to send a CB_ADDSTRING message to the combo box.

Управление сообщениями в очередях Manage messages in queues

Применяется к: Exchange Server 2013 г. Applies to: Exchange Server 2013

В Microsoft Exchange Server 2013 г. для управления сообщениями в очередях можно использовать средство просмотра очередей в ящике инструментов Exchange или в оболочке управления Exchange. In Microsoft Exchange Server 2013, you can use the Queue Viewer in the Exchange Toolbox or the Exchange Management Shell to manage messages in queues. Дополнительные сведения об использовании комлетов управления сообщениями в оболочке управления Exchange см. в тексте Use the Exchange Management Shell для управления очередями. For more information about using the message management cmdlets in the Exchange Management Shell, see Use the Exchange Management Shell to manage queues.

Что нужно знать перед началом работы What do you need to know before you begin?

Предполагаемое время для завершения каждой процедуры: 15 минут Estimated time to complete each procedure: 15 minutes

Для выполнения этих процедур необходимы соответствующие разрешения. Сведения о необходимых разрешениях см. в статье Запись «Очереди» в разделе Разрешения потока обработки почты. You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the «Queues» entry in the Mail flow permissions topic.

Сочетания клавиш для процедур, описанных в этой статье, приведены в статье Сочетания клавиш в Центре администрирования Exchange. For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts in the Exchange admin center.

Возникли проблемы? Having problems? Обратитесь за помощью к участникам форумов Exchange. Ask for help in the Exchange forums. Посетите форумы в Exchange Server. Visit the forums at Exchange Server.

Удаление сообщений из очередей Remove messages from queues

Сообщение, отправляемое нескольким получателям, может находиться в нескольких очередях. A message that’s being sent to multiple recipients might be located in more than one queue. Чтобы удалить сообщение из нескольких очередей с помощью одной операции, следует использовать фильтр. To remove a message from more than one queue in a single operation, you need to use a filter. Вы можете выбрать, отправлять ли отчет о невывозе (NDR) при удалите сообщения из очереди. You can select whether to send a non-delivery report (NDR) when you remove messages from a queue. Вы не можете удалить сообщение из очереди Отправка. You can’t remove a message from the Submission queue.

Для удаления сообщений используйте viewer queue Viewer в ящике инструментов Exchange Use Queue Viewer in the Exchange Toolbox to remove messages

Click Start > All Programs > Microsoft Exchange 2013 > Exchange Toolbox. Click Start > All Programs > Microsoft Exchange 2013 > Exchange Toolbox.

В разделе Средства потока почты дважды щелкните Средство просмотра очереди, чтобы открыть средство в новом окне. In the Mail flow tools section, double-click Queue Viewer to open the tool in a new window.

В списке Просмотра очереди щелкните вкладку Сообщения. Отображается список всех сообщений на сервере, к которому вы подключены. In Queue Viewer, click the Messages tab. A list of all messages on the server to which you’re connected is displayed. Чтобы настроить действие до одной очереди, щелкните вкладку Очереди, дважды щелкните имя очереди, а затем нажмите на появится вкладка Очередь \ сервера. To adjust the action to a single queue, click the Queues tab, double-click the queue name, and then click the Server\Queue tab that appears.

Читайте также:  Linux gnome 40 дистрибутив

Выделите одно или несколько сообщений в списке, щелкните правой кнопкой мыши и выберите команду Удалить сообщения (с отправкой отчета о недоставке) или Удалить сообщения (без отчета о недоставке). Select one or more messages from the list, right-click, and then select Remove Messages (with NDR) or Remove Messages (without NDR). Появится диалоговое окно, которое подтверждает выбранное действие и отображает, необходимо ли продолжить? A dialog box appears that confirms the selected action and displays, Do you want to continue? Нажмите кнопку Да. Click Yes.

Чтобы удалить все сообщения из определенной очереди, щелкните вкладку Queues. Выберите очередь, щелкните правой кнопкой мыши, а затем выберите Удаление сообщений (с помощью NDR) или Remove Messages (без NDR). To remove all messages from a particular queue, click the Queues tab. Select a queue, right-click, and then select Remove Messages (with NDR) or Remove Messages (without NDR). Появится диалоговое окно, которое подтверждает выбранное действие и отображает, необходимо ли продолжить? A dialog box appears that confirms the selected action and displays, Do you want to continue? Нажмите кнопку Да. Click Yes.

При работе с отфильтрованным списком отображаемая страница может содержать не все элементы в фильтре. В этом случае появится запрос: Это действие повлияет на все элементы этой страницы. Чтобы расширить область применения этого действия для включения всех элементов в этом фильтре, установите следующий флажок до нажатия кнопки «OK». If you’re working with a filtered list, the displayed page may not include all items in the filter. In this case, a prompt appears that displays: This action will affect all items on this page. To expand the scope of this action to include all items in this filter, check the following box before you click OK.

Удаление сообщений с помощью оболочки Use the Shell to remove messages

Чтобы удалить сообщения из очередей, введите команду в следующем формате. To remove messages from queues, use the following syntax.

В этом примере из очереди удаляются сообщения с темой «Win Big» без отправки отчета о недоставке. This example removes messages in the queues that have a subject of «Win Big» without sending an NDR.

В этом примере сообщение с ИД-3 удаляется из недостижимой очереди на сервере с именем Mailbox01 и отправляет NDR. This example removes the message with the message ID 3 from the unreachable queue on server named Mailbox01 and sends an NDR.

Как убедиться, что все получилось? How do you know this worked?

Чтобы убедиться в успешном удалении сообщений из очередей, сделайте следующее: To verify that you have successfully removed messages from queues, do one of the following:

В средстве просмотра очереди выберите очередь или создайте фильтр, чтобы убедиться, что сообщение больше не существует. In Queue Viewer, select the queue or create a filter to verify the messages no longer exist.

Чтобы убедиться, что сообщения больше не существуют, используйте комлет Get-Message с параметрами Queue или Filter. Use the Get-Message cmdlet with the Queue or Filter parameters to verify the messages no longer exist. Дополнительные сведения см. в статье Get-Message. For more information, see Get-Message.

Возобновление доставки сообщений, находящихся в очередях Resume messages in queues

Можно возобновить передачу сообщения, которое в текущий момент имеет состояние «Приостановлено». Посредством возобновления передачи сообщения включается доставка сообщения. Если возобновляется передача сообщения, находящегося в очереди подозрительных сообщений, то сообщение будет отправлено в классификатор для обработки. Сообщение, отправляемое нескольким получателям, может находиться в нескольких очередях. Чтобы возобновить передачу сообщения в нескольких очередях за одну операцию, следует использовать фильтр. You can resume a message that currently has a status of Suspended. By resuming a message, you enable delivery of the message. If you resume a message located in the poison message queue, the message will be sent to the categorizer for processing. A message being sent to multiple recipients might be located in multiple queues. To resume a message in more than one queue in a single operation, you must use a filter.

Для возобновления сообщений используйте средство просмотра очередей в ящике инструментов Exchange Use Queue Viewer in the Exchange Toolbox to resume messages

Click Start > All Programs > Microsoft Exchange 2013 > Exchange Toolbox. Click Start > All Programs > Microsoft Exchange 2013 > Exchange Toolbox.

В разделе Средства потока почты дважды щелкните Средство просмотра очереди, чтобы открыть средство в новом окне. In the Mail flow tools section, double-click Queue Viewer to open the tool in a new window.

В списке Просмотра очереди щелкните вкладку Сообщения. Отображается список всех сообщений на сервере, к которому вы подключены. In Queue Viewer, click the Messages tab. A list of all messages on the server to which you’re connected is displayed. Чтобы настроить действие, чтобы сосредоточиться на одной очереди, щелкните вкладку Очереди, дважды щелкните имя очереди, а затем нажмите появится на вкладке Очередь \ сервера. To adjust the action to focus on a single queue, click the Queues tab, double-click the queue name, and then click the Server\Queue tab that appears.

Щелкните Создать фильтр и введите выражение фильтра следующим образом: Click Create Filter, and enter your filter expression as follows:

Выберите Состояние в раскрывающемся списке свойств сообщения. Select Status from the message property drop-down list.

Выберите пункт Равно из раскрывающегося списка операторов сравнения. Select Equals from the comparison operator drop-down list.

Выберите Приостановлено в раскрывающемся списке значений. Select Suspended from the value drop-down list.

Читайте также:  Драйвер горячих клавиш asus windows 10

Нажмите кнопку Применить фильтр. Отобразятся все сообщения, имеющие состояние «Приостановлено». Click Apply Filter. All messages that have a status of Suspended are displayed.

Выделите одно или несколько сообщений в списке, щелкните правой кнопкой мыши и выберите команду Возобновить. Select one or more messages from the list, right-click, and select Resume.

Использование Shell для возобновления сообщений Use the Shell to resume messages

Чтобы возобновить доставку сообщений, используйте следующий синтаксис: To resume messages, use the following syntax:

В данном примере возобновляется передача всех сообщений от всех отправителей в домене Contoso.com. This example resumes all messages being sent from any sender in the Contoso.com domain.

В данном примере возобновляется передача сообщения с идентификатором сообщения 3 в недоступной очереди на сервере Hub01. This example resumes the message with the message ID 3 in the unreachable queue on server Hub01.

Чтобы повторно отправлять сообщения из очереди ядовитых сообщений, выполните следующие действия: To resubmit messages from the poison message queue, perform the following steps:

Как убедиться, что все получилось? How do you know this worked?

Чтобы убедиться в успешном возобновлении сообщений в очередях, сделайте одно из следующих: To verify that you have successfully resume messages in queues, do one of the following:

В viewer queue выберите очередь или создайте фильтр, чтобы убедиться, что сообщения больше не приостановлены. In Queue Viewer, select the queue or create a filter to verify the messages are no longer suspended.

Чтобы убедиться, что сообщения больше не приостановлены, используйте комлет Get-Message с параметрами Queue или Filter. Use the Get-Message cmdlet with the Queue or Filter parameters to verify the messages are no longer suspended. Дополнительные сведения см. в статье Get-Message. For more information, see Get-Message.

Обратите внимание, что если вы не можете найти сообщение в очередях на сервере, это, вероятно, указывает на то, что сообщение было успешно доставлено в следующий переход. Note that if you can’t find the message in any queues on the server, that probably indicates the message was successfully delivered to the next hop.

Приостановка сообщений, находящихся в очередях Suspend messages in queues

Вы можете приостановить доставку сообщения. When you suspend a message, you prevent delivery of the message. Если сообщение появляется в очереди, но уже находится в процессе доставки, то его доставку приостановить нельзя. A message that appears in the queue but is already in delivery won’t be suspended. Доставка будет продолжаться, и состояние сообщения будет pendingSuspend. Delivery will continue, and the message status will be PendingSuspend. Если доставка не удалась, сообщение будет повторно поставлено в очередь, а затем его доставка будет приостановлена. If the delivery fails, the message will re-enter the queue, and the message will then be suspended. Отправку сообщения, которое находится в очереди передачи или в очереди подозрительных сообщений, приостановить нельзя. You can’t suspend a message in the Submission queue or in the poison message queue.

Сообщение, отправляемое нескольким получателям, может находиться в нескольких очередях. A message being sent to multiple recipients might be located in multiple queues. Чтобы приостановить доставку сообщения в нескольких очередях с помощью одной операции, необходимо применить фильтр. To suspend a message in more than one queue in a single operation, you need to use a filter.

Использование просмотра очередей в ящике инструментов Exchange для приостановки сообщений Use Queue Viewer in the Exchange Toolbox to suspend messages

Click Start > All Programs > Microsoft Exchange 2013 > Exchange Toolbox. Click Start > All Programs > Microsoft Exchange 2013 > Exchange Toolbox.

В разделе Средства потока почты дважды щелкните Средство просмотра очереди, чтобы открыть средство в новом окне. In the Mail flow tools section, double-click Queue Viewer to open the tool in a new window.

В списке Просмотра очереди щелкните вкладку Сообщения. Отображается список всех сообщений на сервере, к которому вы подключены. In Queue Viewer, click the Messages tab. A list of all messages on the server to which you’re connected is displayed. Чтобы ограничить представление одной очередью, щелкните вкладку Очереди, дважды щелкните имя очереди и нажмите на появится вкладка Очередь \ сервера. To limit the view to a single queue, click the Queues tab, double-click the queue name, and then click the Server\Queue tab that appears.

Выберите одно или несколько сообщений, щелкните правой кнопкой мыши и выберите команду Приостановить Select one or more messages, right-click, and then select Suspend.

Использование командной консоли для приостановки сообщений Use the Shell to suspend messages

Чтобы приостановить доставку сообщений, используйте следующий синтаксис: To suspend messages, use the following syntax:

В этом примере приостанавливаться все сообщения в очередях, которые находятся от любого отправитель в домене contoso.com. This example suspends all messages in the queues that are from any sender in the domain contoso.com.

В этом примере приостанавливать сообщение с ID-3 сообщения в недостижимой очереди на сервере с именем Mailbox01: This example suspends the message with the message ID 3 in the unreachable queue on server named Mailbox01:

Как убедиться, что все получилось? How do you know this worked?

Чтобы убедиться в успешной приостановке сообщений в очередях, сделайте одно из следующих: To verify that you have successfully suspended messages in queues, do one of the following:

В средстве просмотра очереди выберите очередь или создайте фильтр, чтобы убедиться, что сообщения приостановлены. In Queue Viewer, select the queue or create a filter to verify messages are suspended.

Чтобы убедиться, что сообщения приостановлены, используйте комлет Get-Message с параметрами Queue или Filter. Use the Get-Message cmdlet with the Queue or Filter parameters to verify the messages are suspended. Дополнительные сведения см. в статье Get-Message. For more information, see Get-Message.

Оцените статью