Flows of nutrients and energy link the producers, consumers, decomposers, and the abiotic environment in an ecosystem. Within an ecosystem, the producers obtain energy from the abiotic environment (sunlight). Consumers get nutrients and energy by feeding on other organisms. Decomposers get nutrients and energy by feeding on dead organisms or organic materials.