WebLogic Messaging API Class Library |

# ISession.CreateProducer Method

Creates an `IMessageProducer` to send messages to the specified destination.

A client uses an `IMessageProducer` object to send messages to a destination. Since `IQueue` and `ITopic` both inherit from `IDestination`, they can be used in the destination parameter to create a `IMessageProducer` object.

IMessageProducer CreateProducer(
IDestination destination
);

#### Parameters

IDestination
  the `IDestination` to send to, or null if this is a producer which does not have a specified destination.

#### Return Value

An `IMessageProducer` for the specified destination

#### Exceptions

Exception Type | Condition
--- | ---
MessageException | if the session fails to create a IMessageProducer due to some internal error.
InvalidDestinationException | if an invalid destination is specified.

#### See Also

ISession Interface | WebLogic.Messaging Namespace