WebLogic Messaging API Class Library |

# IMessageConsumer.Close Method

Closes the message consumer.

Since JMS allocates some resources on behalf of a `IMessageConsumer` outside the .NET CLR, clients should Close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

There is no need to close a message consumer if the consumer's parent session or connection is closed, or if its parent context has been closed with CloseAll.

This call blocks until a `Receive` or message listener in progress has completed. A blocked message consumer `Receive` call returns null when this message consumer is closed.

void Close();

#### Exceptions

Exception Type | Condition
--- | ---
MessageException | if JMS fails to Close the consumer due to some internal error.

#### See Also

IMessageConsumer Interface | WebLogic.Messaging Namespace